Install and Configure PHP on Centos

Install PHP

1. Run the yum install command
yum install php

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:
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

8. Restart Apache Server
service httpd restart

No comments:

Post a Comment