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.
<?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.