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.

We upgraded our Debian web server to Wheezy this morning, and after everything else came up fine, Apache appears to have lost the ability to execute PHP scripts, while it was able to do so before the upgrade. Now we only see the PHP code, as if the PHP module weren't enabled.

I've checked all the usual suspects, ensured that the PHP module is loaded and installed, and made sure /etc/apache2/mods-enabled/php5.conf has the "SetHandler application/x-httpd-php" option set. I've also followed the most recent documentation for installing PHP5 on Apache, and everything appears to check out. There aren't any errors in the Apache error log either that would indicate a problem.

Is there anything I've missed?

Output from 'apachectl -t -D DUMP_MODULES |grep php':

Syntax OK
 php5_module (shared)

Output from 'www3:/etc/apache2# apache2 -v':

Server version: Apache/2.2.22 (Debian)
Server built:   Jan 31 2014 18:55:37

Contents of /etc/apache2/mods-enabled/php5.conf:

<IfModule libphp5.so>
#    <FilesMatch "\.ph(p3?|tml)$">
#    </FilesMatch>
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>

Latest apache error logs from the last restart:

[Thu Apr 10 15:35:44 2014] [notice] caught SIGTERM, shutting down
[Thu Apr 10 15:35:45 2014] [warn] No JkLogFile defined in httpd.conf. Using default /var/log/apache2/mod_jk.log
[Thu Apr 10 15:35:45 2014] [warn] No JkShmFile defined in httpd.conf. Using default /var/log/apache2/jk-runtime-status
[Thu Apr 10 15:35:45 2014] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Apr 10 15:35:45 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Thu Apr 10 15:35:45 2014] [notice] Digest: generating secret for digest authentication ...
[Thu Apr 10 15:35:45 2014] [notice] Digest: done
[Thu Apr 10 15:35:45 2014] [warn] No JkLogFile defined in httpd.conf. Using default /var/log/apache2/mod_jk.log
[Thu Apr 10 15:35:45 2014] [warn] No JkShmFile defined in httpd.conf. Using default /var/log/apache2/jk-runtime-status
[Thu Apr 10 15:35:45 2014] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Apr 10 15:35:45 2014] [notice] Apache/2.2.22 (Debian) DAV/2 SVN/1.6.17 mod_fcgid/2.3.6 mod_jk/1.2.37 PHP/5.4.4-14+deb7u8 mod_ssl/2.2.22 OpenSSL/1.0.1e mod_perl/2.0.7 Perl/v5.14.2 configured -- resuming normal operations
share|improve this question
    
Could you post the latest portion of the Apache error logs? Also, afte restarting Apache, are you given any warning? –  Peter Kirby Apr 10 at 22:52
1  
What does the browser receive from the server when you request a PHP script? –  Tero Kilkanen Apr 10 at 23:01
    
@TeroKilkanen: Added that to my question. I just get PHP code. –  Ernie Apr 10 at 23:19

3 Answers 3

Try running the following commands:

sudo apt-get purge libapache2-mod-php5

sudo apt-get install libapache2-mod-php5

sudo a2enmod php5

sudo service apache2 restart

This will reinstall all the necessary packages to get Apache capable of running mod_php.

You might also make sure that the file php5.conf is in the directory /etc/apache2/mods-enabled. If it is, you should see something like:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
share|improve this answer
    
Nah, this didn't work. It's worth noting that Debian will automatically restart Apache when you install libapache2-mod-php5, and when I ran 'a2enmod php5' it said "Module php5 already enabled" –  Ernie Apr 10 at 23:40
    
I've even tried uninstalling all the PHP packages, then starting with the simplest possible setup. No dice. –  Ernie Apr 11 at 4:56

php5-suhosin is no longer available in wheezy, but unless you purge the package, its .ini file is still in /etc/php5/conf.d/ which will prevent PHP from running.

See: https://www.debian.org/releases/stable/i386/release-notes/ch-upgrading.html#idp836640

share|improve this answer
    
I actually noticed this beforehand. Sorry, didn't do anything. –  Ernie Apr 11 at 4:55

It turns out that this is a problem with one of the Apache modules. Disabling most of them resolved the problem and then we started adding them back until everything else was working.

share|improve this answer
    
When you end up figuring out which one was causing the issue, I would be interested to know! –  Peter Kirby Apr 11 at 19:51
    
Maybe I'll try this out on Saturday, when customers aren't likely to complain nearly as much when we test to failure. :) –  Ernie Apr 11 at 22:55

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.