Showing posts with label centos. linux. Show all posts
Showing posts with label centos. linux. Show all posts

Install, Configure and Test PHP on linux machines

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. It is a fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.

Installing PHP
# yum install php

1. Increasing PHP script memory limit</span>
# vi /etc/php.ini
replace memory_limit = 16M to memory_limit = 128M

2. Increasing PHP script max execution time
# vi /etc/php.ini
replace max_execution_time = 30 to max_execution_time = 120

3. Increasing PHP script max upload size
# vi /etc/php.ini
replace max_upload_size = 2M to max_upload_size = 50M

4. # vi /etc/php.ini
replace post_max_size = 8M to post_max_size = 50M

Additional steps
# mkdir /usr/share/phpinfo
# vi /usr/share/phpinfo/index.php
<?php
phpinfo();
?>

Change permissions on the index.php
# chmod 0755 /usr/share/phpinfo/index.php
# vi /etc/httpd/conf.d/phpinfo.conf
# phpinfo - PHP utility function for displaying php configuration
#
# Allows only localhost by default

Alias /phpinfo /usr/share/phpinfo
<Directory /usr/share/phpinfo/>
order deny,allow
deny from all
allow from 127.0.0.1
</Directory>

Restart Apache Server
# /etc/init.d/httpd restart
# service httpd restart
Testing

On any browser you have installed, point the URL as http://localhost/phpinfo

configure xrdp in centOS

Sometimes it becomes worthy and cozy to handle linux machines from windows. To get rid of such situation, we can configure packages in linux machines to allow remote desktop from windows machines like we connect windows machines from windows machines using a client named remote desktop or mstsc. XRDP is a cross platform to connect between windows machines and linux machines.

lets begin with the installation and configurations for xrdp.
1. Make sure necessary packages are installed.
Packages required are:
xrdp, tiger-vncserver, autoconf, automake, libtool, openssl-devel, pam-devel, libX11-devel, libXfixes-devel
[root@gyasu Downloads]# yum -y install tiger-vncserver, autoconf, automake, libtool, openssl-devel, pam-devel, libX11-devel, libXfixes-devel

2. Download and install core package xrdp from sourceforge.net or google. After download move to the download directory and untar the file.
[root@gyasu Downloads]# tar -zxvf xrdp-v0.6.1.tar.gz
[root@gyasu Downloads]# cd xrdp-v0-6.1
[root@gyasu xrdp-v0.6.1]# ./bootstrap
[root@gyasu xrdp-v0.6.1]# ./configure
[root@gyasu xrdp-v0.6.1]# make
[root@gyasu xrdp-v0.6.1]# make install
This way main installation finishes and the next part is user administration part.

3. Add users and groups
[root@gyasu xrdp-v0.6.1]# groupadd normal-users
[root@gyasu xrdp-v0.6.1]# groupadd admin-users
[root@gyasu xrdp-v0.6.1]# vi /etc/group

## And make the changes as belows to give access from windows machines
normal-users:x:501:gsuwal
admin-users:x:502:root

4. Assign user priveleges
[root@gyasu xrdp-v0.6.1]# su - gsuwal
[gsuwal@gyasu ~]$ vncpasswd 
Password:
Verify:
[gsuwal@gyasu ~]$ 

Now return to the root user to modify vncserver settings
[gsuwal@gyasu ~]$ exit
logout
[root@gyasu xrdp-v0.6.1]# 
[root@gyasu xrdp-v0.6.1]# vi /etc/sysconfig/vncservers 
## make the following changes at the end of the file
vi /etc/sysconfig/vncservers

VNCSERVERS="1:gsuwal"
VNCSERVERARGS[1]="-geometry 1280x960 -depth 16"

## gsuwal is your desired username in linux used from windows machine to connect to linux machine
## geometry is the resolution and depth 16 is the connection bit

Now make sure the xrdp server runs automatically after each reboot by adding to local.repo
[root@gyasu xrdp-v0.6.1]# vi /etc/rc.local
## And append the service command, save and quit
/etc/xrdp/xrdp.sh start

Save everything, restart all the processes.
[root@gyasu xrdp-v0.6.1]# /etc/xrdp/xrdp.sh start
xrdp is already loaded
[root@gyasu xrdp-v0.6.1]# chkconfig vncserver start
[root@gyasu xrdp-v0.6.1]# service vncserver restart

Hence, we can easily connect to linux machines from windows machine successfully.

Note: tested successfully in centOS 6