Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

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

share|improve this answer
    
Those commented lines are previous attempts at getting it to work properly. Stated that I had already insured the PHP module was being loaded properly. –  Nickolas Whiting Apr 1 '11 at 18:20

You can try to run "php -v" command from console, it should print out notice of your php version, and also attach the error messages from your php.ini config file.

Did you restarted Apache after installing PHP 5.2.6 ?

share|improve this answer
    
mmm ... I am not having a problem getting PHP to work as previously stated this is already a working server infact I never mentioned installing PHP ... did you thoroughly read the post? –  Nickolas Whiting Apr 1 '11 at 18:22
up vote 0 down vote accepted

Issue has been resolved ... not sure how or why but apparently replicating the folder structure and configuration same exact config which had already been attempted and failed of a Plesk created domain appeared to resolve this problem ...

Resulting config

<VirtualHost myip:80>
    ServerAlias *.mydomain.com
    ServerName   mydomain.com
    DocumentRoot /var/www/vhosts/mydomain.com/httpdocs
    CustomLog  /var/www/vhosts/mydomain.com/statistics/logs/access_log plesklog
    ErrorLog  /var/www/vhosts/mydomain.com/statistics/logs/error_log
    <IfModule mod_userdir.c>
        UserDir /var/www/vhosts/mydomain.com/web_users
    </IfModule>
    <IfModule mod_ssl.c>
        SSLEngine off
    </IfModule>
    <Directory /var/www/vhosts/mydomain.com/httpdocs>
    <IfModule sapi_apache2.c>
        php_admin_flag engine on
        php_admin_flag safe_mode off
        php_admin_value open_basedir "/var/www/vhosts/mydomain.com/httpdocs:/tmp"
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_flag engine on
        php_admin_flag safe_mode off
        php_admin_value open_basedir "/var/www/vhosts/mydomain.com/httpdocs:/tmp"
    </IfModule>
        Options -Includes -ExecCGI
    </Directory>
    <Directory /var/www/vhosts/mydomain.com/web_users>
    <IfModule sapi_apache2.c>
        php_admin_flag engine off
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_flag engine off
    </IfModule>
    </Directory>
</VirtualHost>

Note that this is just another reason I dislike Plesk ....

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.