2014-02-18 114 views
0

我想关闭.htaccess文件中的所有php错误。我尝试使用下面的stackoverflow问题。允许htaccess文件apache

Enabling error display in php via htaccess only

.htaccess文件:

php_flag display_startup_errors off 
php_flag display_errors off 
php_flag html_errors off 
php_flag log_errors on 
php_value error_log /home/petstail/public_html/PHP_errors.log 

而在我的httpd.conf文件,在虚拟主机我把目录一样,

<Directory "/home/website/public_html"> 
    Options All MultiViews 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
</Directory> 

错误日志:

Invalid command 'php_flag', perhaps misspelled or defined by a module not 
included in the server configuration 

但是,我仍然收到内部服务器错误(500)。我该怎么办?我错过了什么配置?

谢谢。

+0

您是否重新启动了服务器? – hek2mgl

+1

首先检查你的Apache error.log,看看为什么500会来。 – anubhava

+0

请检查我的编辑请求.. –

回答

0

“由未包含在服务器配置中的模块定义”很可能是原因。它告诉你,不允许在.htaccess文件中设置php_flag。您需要在vHost配置中设置这些值 - 或者在php.ini中更好。

+0

我该怎么做?你能详细说明你的答案吗..我对服务器配置了解不多。 –

+0

在这种情况下,你可能更好[在应用程序中使用'error_reporting(0)'](http://php.net/manual /en/function.error-reporting.php)......我只是不想在这里发布一个关于Apache配置的完整教程 - 网络上有很多这样的教程。 – feeela