Php – Apache (2.2.3) not serving PHP (5.2.6) Running on CentOS

apache-2.2PHP

I'm having a bit of a strange problem with a new domain I'm setting up; Apache is currently not serving PHP files as it should and rather forcing a download of a .PHTML file.

I have searched Google and used the search without any fixes found.

This problem gets a bit strange as I currently have other sites running on the same server and have been for well over 2 years with the same configuration and they are not experiencing this problem.

The VirtualHost config is as follows

<VirtualHost *:80>
    DocumentRoot /var/www/vhosts/mydomain.com/httpdocs
    ServerAlias *.mydomain.com
    ServerName mydomain.com
    #AddHandler application/x-httpd-php .php
    #DirectoryIndex index.php
    <Directory />
        Options FollowSymLinks
        AllowOverride All
        Order deny,allow
        Allow from all
    </Directory>
    CustomLog "/var/www/vhosts/mydomain.com/logs/combined.log" combined
</VirtualHost>

As you can see it is incredibly simple …

I have tried the following with no avail

  • Insuring the PHP module is loaded
  • Insuring PHP files are seen as PHP files by apache
  • Testing other sites with the same configuration

Now I'm not sure but I think that it may have something to do with the fact that Plesk is installed and used to manage most not all of the domains hosted on this server hosted through Media Temple

This of course is one of the domains which cannot be configured via Plesk as a custom VirtualHost conf is needed and Plesk simply does not allow for this … well easily that is.

I'm posting here first before contacting Media Temple as last time I had an issue with Apache configuration Media Temple was pretty much no help on the subject as it is out of their support range, and I don't have 30 minutes to spend on hold…

Best Answer

Have you tried uncommenting the lines with php?

#AddHandler application/x-httpd-php .php
#DirectoryIndex index.php

The shouldn't have # signs starting their lines, that comments them out.

Also, make sure that you have the php.conf file in your apache conf.d/ directory (or whichever directory you are using for your conf files).