To Install Apache And PHP, follow the instructions below:

Run the following command

yum install httpd

Now we need to start Apache, so run the following command

service httpd start

We need to install PHP, PHP-Devel so that we have some developer tools, and PHP-MySQL so that we can access MySQL through our PHP scripts.
Run the following commands

yum install php
yum install php-devel
yum install php-mysql

The PHP configuration file is called “php.ini” and is located at /etc/php.ini
Most common configuration changes:

log_errors (if on, must specify log file name)

Creating a PHP/MySQL Page
First we need to get to our document root, for example "cd /var/www/html/"

Run this command to get the source files:


Now let’s unzip this file:


Now let’s make sure the file is set to connect to our database:

vi index.php

Now that we’ve verified this, let’s visit our site and see what happens. Run the following command:

vi phpinfo.php

Even though it is one line of code it is very powerful and gives you a lot of information about the current PHP install.