php PHP错误日志不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5072987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Php error log not working
提问by Parris Varney
It's been working for ages and stopped. I must be missing something obvious so figured stack overflow might be able to help.
它已经工作了很长时间并停止了。我一定遗漏了一些明显的东西,所以认为堆栈溢出可能会有所帮助。
/etc/php5/apache2/php.ini relevant settings are:
/etc/php5/apache2/php.ini 相关设置有:
display_errors = On (not sure if this makes a difference)
log_errors = On
error_log = "/var/www/error_log.log"
In my code I have:
在我的代码中,我有:
echo 'About to log';
error_log('An error');
I see About to log on the page, but nothing in the error log. Any ideas?
我在页面上看到关于登录,但错误日志中没有任何内容。有任何想法吗?
回答by mlemos
Did you restart the Web server? Until you do php.ini
changes are not considered.
您是否重新启动了 Web 服务器?直到你做php.ini
更改才会被考虑。
Also, if you want to track PHP errors, you need to have track_errors=On
and error_reporting=E_ALL
, although that is not related with error_log
calls. Also make sure that the error log file is writeable by the Web server user.
此外,如果您想跟踪 PHP 错误,您需要有track_errors=On
和error_reporting=E_ALL
,尽管这与error_log
调用无关。还要确保 Web 服务器用户可以写入错误日志文件。
回答by Parris Varney
It ended up being permission issues. The file grew too big to open quickly, so I deleted and recreated it, but with read only permissions.
它最终成为许可问题。该文件太大而无法快速打开,因此我删除并重新创建了它,但具有只读权限。
Totally forgot I deleted it, what a pain.
完全忘记我删除了它,真是太痛苦了。
回答by andymel
In my php.ini file (Xampp default), there was a second entry for error_log
overriding the one that I had set.
So if the other answers do not work for you too, search again for multiple entries of the necessary settings.
在我的 php.ini 文件(Xampp 默认)中,有第二个条目用于error_log
覆盖我设置的条目。因此,如果其他答案也不适用于您,请再次搜索所需设置的多个条目。