HostOnNet Blog

Install PHP On CentOS

Looking for Linux Server Admin or WordPress Expert? We can help.

PHP is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

To install php, open terminal and type in this command:

yum install php php-mysql php-gd php-pear -y

You can install multiple libraries at once by separating the name of each module with a space.

Test PHP:

Create a sample “test.php” file in Apache document root folder and append the lines as shown below:

vi /var/www/html/test.php

Add the following lines.


Then Save and Exit.

Restart apache so that all of the changes take effect on your virtual server:

service httpd restart

Now you can access your php info page http://IP/test.php. It will display all the details about php such as version, build date and commands etc.

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.
Posted in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.