Showing posts with label php in linux. Show all posts
Showing posts with label php in 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