5

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
3
  • Could you post the latest portion of the Apache error logs? Also, afte restarting Apache, are you given any warning? Apr 10, 2014 at 22:52
  • 1
    What does the browser receive from the server when you request a PHP script? Apr 10, 2014 at 23:01
  • @TeroKilkanen: Added that to my question. I just get PHP code.
    – Ernie
    Apr 10, 2014 at 23:19

3 Answers 3

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
3
  • 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, 2014 at 23:40
  • I've even tried uninstalling all the PHP packages, then starting with the simplest possible setup. No dice.
    – Ernie
    Apr 11, 2014 at 4:56
  • worked for me after an dist-upgrade. just needed to match the php version #
    – Bozojoe
    Jun 1, 2018 at 3:56
2

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.

2
  • When you end up figuring out which one was causing the issue, I would be interested to know! Apr 11, 2014 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, 2014 at 22:55
0

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

1
  • I actually noticed this beforehand. Sorry, didn't do anything.
    – Ernie
    Apr 11, 2014 at 4:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .