我们今天早上将我们的 Debian 网络服务器升级到了 Wheezy,在一切正常之后,Apache 似乎失去了执行 PHP 脚本的能力,而在升级之前它能够这样做。现在我们只看到 PHP 代码,就好像 PHP 模块没有启用一样。
我检查了所有常见的嫌疑人,确保 PHP 模块已加载并安装,并确保 /etc/apache2/mods-enabled/php5.conf 设置了“SetHandler application/x-httpd-php”选项。我还关注了在 Apache 上安装 PHP5 的最新文档,一切似乎都已检查。Apache 错误日志中也没有任何表明存在问题的错误。
有什么我错过的吗?
'apachectl -t -D DUMP_MODULES |grep php' 的输出:
Syntax OK
php5_module (shared)
'www3:/etc/apache2# apache2 -v' 的输出:
Server version: Apache/2.2.22 (Debian)
Server built: Jan 31 2014 18:55:37
/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>
上次重启的最新 apache 错误日志:
[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
尝试运行以下命令:
这将重新安装所有必要的软件包,以使 Apache 能够运行 mod_php。
您还可以确保文件 php5.conf 位于 /etc/apache2/mods-enabled 目录中。如果是,您应该会看到如下内容:
事实证明,这是其中一个 Apache 模块的问题。禁用它们中的大多数解决了问题,然后我们开始将它们添加回来,直到其他一切正常。
php5-suhosin
在 wheezy 中不再可用,但除非您清除包,否则它的.ini
文件仍在其中,/etc/php5/conf.d/
这将阻止 PHP 运行。参见:https ://www.debian.org/releases/stable/i386/release-notes/ch-upgrading.html#idp836640