关于 [error] an unknown filter was not added: PHP 的解决

之前不知道什么时候apache log 不停的出现an unknown filter was not added: PHP,由于出现的次数少,没有理会。

随着最近请求量加大,每天这个log已经占用了100多M的空间,实在忍不了了。

Sat Aug 31 01:05:45 2013] [error] an unknown filter was not added: PHP
[Sat Aug 31 01:05:45 2013] [error] an unknown filter was not added: PHP
[Sat Aug 31 01:05:45 2013] [error] an unknown filter was not added: PHP
[Sat Aug 31 01:05:45 2013] [error] an unknown filter was not added: PHP
[Sat Aug 31 01:05:45 2013] [error] an unknown filter was not added: PHP
[Sat Aug 31 01:05:45 2013] [error] an unknown filter was not added: PHP
[Sat Aug 31 01:05:47 2013] [notice] caught SIGTERM, shutting down

网上查了一下说是

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Since 4.3.2RC the default Apache 2 sapi is the apache2handler and is no longer filter based. Therefor you should use
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

and not

<Files *.php>
       SetOutputFilter PHP
       SetInputFilter PHP
</Files>

看上去是个bug,解决方案也给了 然给你用addType 不要用Files,但是我自己检查配置文件均无 Files *.php 字段。

突然想起有可能apache模块启用了相关功能。

果然在mods-enabled 发现了php5filter.conf 和 php5filter.load 两个配置。 果断 a2dismod 模块! 问题解决。

当然要确保 apache2.conf 已经有

AddType application/x-httpd-php .php
DirectoryIndex index.htm index.html index.php

如上代码。

以上为题发生于apt-get安装,自行编译无法使用a2dismod 相关指令。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注