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've run into a problem with my Apache 2.2.16 configuration, running on Debian Squeeze. The problem is that it stopped serving PHP5-scripts completely. When I try to access the sites with Google Chrome, it instead downloads a file called "download", which contains the contents of the script. This is of course not a good thing. It does serve common html-files perfectly...

I've been at this for quite a while now, and after all the googling and troubleshooting, I thought it would be a good time to ask you guys. Here's what I've got:

  1. The php5 and libapache2-mod-php5 packages are installed
  2. /etc/apache2/mods-available contains both php5.load and php5.conf, and these are symlinked from the mods-enabled directory
  3. The /etc/php5/ directory is left untouched since the installation.

Here's the contents of /etc/apache2/mods-available/php.load:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

And /etc/apache2/mods-available/php.conf:

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>

What am I missing? This is a server with modified virtual hosts and the like, so I might have changed some settings which causes this problem, but simply purging and reinstalling is not an option so far, since the configuration is quite extensive. Any help would be great. Thanks.

Edit: I'm trying to access the scripts running in virtual apache hosts, under /var/www/. The configuration for those look like this:

<VirtualHost 1.2.3.4:80>
        ServerAdmin webmaster@domain.com
        ServerName domain.com
        ServerAlias www.domain.com
        DocumentRoot /var/www/domain.com/public_html/
        ErrorLog /var/www/domain.com/logs/error.log
        CustomLog /var/www/domain.com/logs/access.log combined
        Options -indexes
</VirtualHost>
share|improve this question

migrated from superuser.com Feb 26 '11 at 14:59

This question came from our site for computer enthusiasts and power users.

    
Maybe something in /var/www/domain.com/logs/error.log? –  azat Feb 26 '11 at 21:50
    
Just to make sure, 'apache2ctl -M' lists the php5_module amongst others? I ask because of the 'from' in your 2. "..these are symlinked from the mods-enabled directory.." (the links should go from avail to enabled). –  desasteralex Feb 26 '11 at 22:10
    
Ah, that was my mistake. They are symlinked from sites-available, to sites-enabled. 'apache2ctl -M' includes "php5_module (shared)". –  cmbrnt Feb 26 '11 at 23:52
    
Running into the same problem after a recent system upgrade. Ever figure this out? –  zigdon May 23 '11 at 23:25
add comment

2 Answers

You could try removing the entire php_admin_value engine Off setting, perhaps you are unexpectedly matching the scripts. Does FilesMatch do case-insensitive matching? Perhaps check the syntax of your regexps?

How is php.conf being loaded? Double check that it is being loaded correctly.

share|improve this answer
add comment

Where are you trying to access the php script from? I'm guessing somewhere in /home/*/public_html?

I believe php_admin_value engine Off will turn off the engine value in php.ini.. and per the php.ini commments, it should be on:

; Enable the PHP scripting language engine under Apache.
engine = On

What happens if you change php_admin_value engine Off to php_admin_value engine On

share|improve this answer
    
I added some clarification in the original post. I'm not running anything in the home directories, but under /var/www/<site>/public_html. –  cmbrnt Feb 26 '11 at 17:03
add comment

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.