Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Today I did a dist-upgrade from Lenny to Squeeze (I've done this before on many other servers without much trouble), and most everything seems to work except for PHP. Sites that use PHP just show the PHP files instead of the server generating them. As far as I can tell, the Apache server is actually running properly with PHP according to the error log, but it's just acting as if it's not running at all.

An odd thing that I've caught in the troubleshooting is that /etc/asterisk/mods-enabled/php5.conf seems to refer to a file that doesn't exist; namely mod_php.c. That doesn't sound like a compiled module to me though, and at the same time, mod_php.c and do not exist on the system, in spite of how the Debian dpkg system seems to think it is.

Here's the contents of php5.conf:

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    <FilesMatch "\.phps$">
         SetHandler application/x-httpd-php-source
    # 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

I get the following error messages when restarting apache:

[Tue Apr 26 15:46:42 2011] [notice] caught SIGTERM, shutting down
[Tue Apr 26 15:46:43 2011] [warn] No JkLogFile defined in httpd.conf. Using default /var/log/apache2/mod_jk.log
[Tue Apr 26 15:46:43 2011] [warn] No JkShmFile defined in httpd.conf. Using default /var/log/apache2/jk-runtime-status
[Tue Apr 26 15:46:43 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Apr 26 15:46:44 2011] [notice] Digest: generating secret for digest authentication ...
[Tue Apr 26 15:46:44 2011] [notice] Digest: done
[Tue Apr 26 15:46:44 2011] [warn] No JkLogFile defined in httpd.conf. Using default /var/log/apache2/mod_jk.log
[Tue Apr 26 15:46:44 2011] [warn] No JkShmFile defined in httpd.conf. Using default /var/log/apache2/jk-runtime-status
[Tue Apr 26 15:46:44 2011] [error] python_init: Python version mismatch, expected '2.6.5+', found '2.6.6'.
[Tue Apr 26 15:46:44 2011] [error] python_init: Python executable found '/usr/bin/python'.
[Tue Apr 26 15:46:44 2011] [error] python_init: Python path being used '/usr/lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload'.
[Tue Apr 26 15:46:44 2011] [notice] mod_python: Creating 8 session mutexes based on 110 max processes and 0 max threads.
[Tue Apr 26 15:46:44 2011] [notice] mod_python: using mutex_directory /tmp
[Tue Apr 26 15:46:44 2011] [notice] Apache/2.2.16 (Debian) DAV/2 SVN/1.6.12 mod_fcgid/2.3.6 mod_jk/1.2.26 PHP/5.3.3-7+squeeze1 with Suhosin-Patch mod_python/3.3.1 Python/2.6.6 mod_ssl/2.2.16 OpenSSL/0.9.8o mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
share|improve this question
up vote 1 down vote accepted

Sounds like the problem is with mod_jk.

The stable package for squeeze is libapache-mod-jk (1:1.2.30-1squeeze1) which was updated from lenny's package libapache-mod-jk (1:1.2.26-2+lenny1)

There is a confirmed Debian package bug report that after upgrade mod_jk won't connect to tomcats but is is supposed to be fixed in the latest version.

Try upgrading it with apt-get and see if it gives you the new version if not do apt-get install libapache-mod-jk and choose to keep your existing config files if it asks. (Probably should back up any config files before doing the upgrades.

Also did you reboot the server after you upgraded? When I went from lenny to squeeze the kernel didn't upgrade until I rebooted.

share|improve this answer
Ok, I tried installing libapache2-mod-jk and installing tomcat6 as apt-get recommended when I did so. This still doesn't fix the problem with PHP5. It's also worth noting that the server is definitely running the new kernel as per uname. – Ernie Apr 27 '11 at 3:56
Oh weird. Now it's working. This is the last thing I tried, so I'm guessing that's what fixed it. But it didn't seem to work right away either. I'm calling Heisenberg on this one. – Ernie Apr 27 '11 at 6:10
I Feel you.. When I updated to Squeeze I lost my whole iptables settings and ethernet card settings. – Chris_O Apr 27 '11 at 6:14

Did you replace any Apache configuration files during the dist-upgrade? Check /etc/apache2 and all subdirectories for *-old files. If they exist, check for differences - perhaps you had enabled PHP in a non-standard way, or modified apache2.cfg for example, and the relevant changes were overwritten. Check that mod_php is present on /etc/apache2/mods-enabled and enable it using a2enmod if not.

Do you use mod_python? The error log you posted shows python errors.

share|improve this answer
Nope, no luck. I've even moved over entirely to the dist-upgrade configuration, and it still doesn't use PHP. mod_php is present in /etc/apache2/mods-enabled, and I've added that configuration file to the code in my question. – Ernie Apr 27 '11 at 3:41

Your Answer


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.