2

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

0

4 Answers 4

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

1
  • 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. Commented Apr 1, 2011 at 18:20
0

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 ?

1
  • 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? Commented Apr 1, 2011 at 18:22
0

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

0

Make sure that line containing php_admin_flag engine in the right section is On. This is by default disabled on some Linux distributions.

If you're using mod_userdir Apache extension, enable it (via a2enmod userdir) and you've to edit /etc/apache2/mods-enabled/php*.conf file to enable above flag as well.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.