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.
Create a sample “test.php” file in Apache document root folder and append the lines as shown below:
Add the following lines.
<?php phpinfo(); ?>
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.