How to install PHP on CentOS RedHat Linux, How to configure PHP on CentOS RedHat Linux

PHP

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.  For more information on PHP, visit their website at

www.php.net.

Version

This documentation was written for PHP 5.1.6 but may be useful with other versions.

How to install PHP

Run the yum install command
yum install php


How to configure PHP



1. Increase PHP script memory limit
In the /etc/php.ini file replace memory_limit = 16M with memory_limit = 128M

2. Increase PHP script max execution time
In the /etc/php.ini file replace max_execution_time = 30 with max_execution_time = 120

3. Increase PHP script max upload size
In the /etc/php.ini file replace max_upload_size = 2M with max_upload_size = 50M
In the /etc/php.ini file replace post_max_size = 8M with post_max_size = 50M

4. Create the /usr/share/phpinfo folder
mkdir /usr/share/phpinfo

5. Create the /usr/share/phpinfo/index.php file with the following text:

  phpinfo();
?>
 
6. Change permissions on the index.php file
chmod 0755 /usr/share/phpinfo/index.php

7. Create the /etc/httpd/conf.d/phpinfo.conf file with the following text:
# phpinfo - PHP utility function for displaying php configuration
#
# Allows only localhost by default

Alias /phpinfo /usr/share/phpinfo

order deny,allow
deny from all
allow from 127.0.0.1

8. Restart Apache Server
service httpd restart

Test

Visit localhost/phpinfo in your web browser. You should see the infamous phpinfo output. If the address bar changes to something other than http://localhost/phpinfo/, than something went wrong while following the instructions and your browser has interpreted this as a search. Try following the instruction again. If it still doesn't work, send me an email via my contact page and let me know something isn't working right. If it did work, you have successfully installed PHP.


  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to install ionCube Loader on Ubuntu

ionCube is a Zend-Engine extension to encode PHP files. To install it on Ubuntu first...

Install Postfix to configure SMTP Server. -- Fedora 16

[root@mail ~]# yum -y install postfix [root@mail ~]# vi /etc/postfix/main.cf #...

Install Dovecot to Configure POP/IMAP Server. -- Fedora 16

[root@mail ~]# yum -y install dovecot [root@mail ~]# vi /etc/dovecot/dovecot.conf # line...

Create SSL Certficates for Mail server - Fedora 16

[root@www ~]# cd /etc/pki/tls/certs [root@www certs]# make server.key umask 77 ; \...

Configure Postfix and Dovecot for SSL - Fedora 16

[1] Create certifcate first. Click here[2] Configure Postfix and Dovecot for SSL [root@www ~]#...