http apache server doesn’t handle php files

Solution:

First insure that you have the PHP Apache module installed.

ls -l /etc/httpd/conf.d/php.conf

If you don’t have that file then you may just have the php-cli (command line interface) installed without the php Apache httpd module. To install run the command:

sudo yum install php -y

Then restart your httpd server:

sudo service httpd restart

For Apache httpd to process index.php files, you need to update your DirectoryIndex to handle PHP directory indexes.

On Centos edit the file:

/etc/httpd/conf/httpd.conf

Search for the line starting:

DirectoryIndex

And add the following to the space delimited list of index filenames:

index.php

Directory index files will be recognized in the order they are defined.

You will also need to restart your httpd service using:

sudo service httpd reload

Alternatively you can use the apachectl utility to reload httpd gracefully

sudo apachectl graceful