Monday, 4 June 2012

Install and Configure PHP on CentOS

Install and Configure PHP on CentOS


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


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

How to install PHP

  1. Run the yum install command   
yum install php

How to configure PHP

Increase PHP script memory limit

In the /etc/php.ini file replace memory_limit = 16M with memory_limit = 128M

Increase PHP script max execution time

In the /etc/php.ini file replace max_execution_time = 30 with max_execution_time = 120

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

Create the /usr/share/phpinfo folder

mkdir /usr/share/phpinfo

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


Change permissions on the index.php file

 chmod 0755 /usr/share/phpinfo/index.php 

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
<Directory /usr/share/phpinfo/>
   order deny,allow
   deny from all
   allow from

Restart Apache Server

service httpd stop

service httpd start


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.

Further Reading:

  1. Install and configure CentOS on VMware Workstation
  2. Install VMware Tools
  3. Add external HDD to the VM
  4. Update CentOS
  5. Install and Configure the Yum Priorities plug-in
  6. Install and Configure the EPEL Repository
  7. Install and Configure the Remi Repository
  8. Install and Configure Apache HTTP Server 
  9. Installing and Configuring LAMP on CentOS


Andria BZ said...

Great Post, Actually PHP is a beautiful source for developing a database driven web application, I love this post, thanks for spending your time for discussing about this topic.
Best PHP Training in Chennai|PHP Institutes in Chennai

Harshita said...

Thanks for the article. It has given me some idea of what I have been looking for and helped a lot, thank you. Come up with more such articles, wish to follow.
PHP course in Chennai | PHP course in Chennai | PHP course in Chennai

Addison adolf said...

We are offering Android Apps Development in affordable price.......

Anastasia Amelie said...

Woocommerce plugin for your online shopping website....

woocommerce notifications

Bay Max said...

Extraordinary post.Your screenshots gives a clear identification of installing PHP.Thanks for sharing this.
php course in chennai | PHP Training Institute in Chennai

Kayal Vizhi said...

Great post. I am happy to visit your blog. Thanks for sharing.

Wordpress development in chennai

caroline jesi said...

Great and impressive article!! Got to learn and know more about web development. To know more refer create website for much more unique ideas.PHP Training in Chennai | Best PHP training in Chennai

Akalya Sekar said...

Good post. Thanks for sharing such a useful post.

Magento eCommerce Website Development

slitheriocontrols said...

Very good. you are the winner. Do not forget update new information regularly. thank !

hoa pikey said...

Great! Thanks for sharing the information. That is very helpful for increasing my knowledge in this fiel
Red Ball | | duck life | Slitherio
Red Ball 2 | Red Ball 3 | Red Ball 4

Melisa said...

Excellent Post! As the demand of java programming application keeps on increasing, there is massive demand for java professionals in software development industries. Thus, taking training will assist students to be skilled java developers in leading MNCs.
Java Training in Chennai
.Net Training in Chennai
PHP Training in Chennai

Best Multimedia (Dilsukhnagar Arena) said...

best for web design...web design course

Andrew Son said...

Software testing is to be done for developing process. For testing a software, testers use test plans, test cases, etc ,to ensure the completeness of testing. Software testing is required to point out the defects and errors for development phrases.Start your career in testing field.It has great scope in future.
Software Testing Training in chennai | Digital Marketing Training in Chennai | SEO Training in Chennai

Steve Hawks said...

Java is programming language which is used in almost all the applications and games which are on the web. Java is being used extensively and it will be used extensively in near future. So getting trained in Java will surely be helpful.
Java Training in chennai | Android Training in Chennai | Selenium Training in Chennai

Priya R said...

Very interesting content which helps me to get the in depth knowledge about the technology. To know more details about the course visit this website.
hadoop training in chennai | Big Data Training in Chennai

Paul Miller said...

Distinctive levels of testing will use in various fields.Fita offers a world class get prepared on programming testing with close joint effort. It offers monstrous occupation prospects for capable experts to be skilled programming analyzers.
Software Testing Training in Chennai | Best software Testing Training institute in Chennai | Software Testing courses in Chennai

geethu said...

Excellent content. Thanks for sharing content which is very useful that provided me the required information.
Cloud Computing Training in Chennai | Cloud Computing Courses in Chennai

Post a Comment