在 PHP 中使用 WAMP 服务器记录错误 [英] Error logging with WAMP server in PHP
问题描述
我有一台 WAMP 2.2 服务器在 Windows 7 机器上运行,但根本无法进行 PHP 错误日志记录.
I have a WAMP 2.2 server running on a Windows 7 box and cannot get PHP error logging working at all.
即使在我明确触发 USER_ERROR 错误或导致正常的 ERROR 错误后,该文件也始终为空白.
The file is always blank even after I explicitly trigger USER_ERROR errors, or cause normal ERROR errors.
我包含了 php.ini
文件的错误相关部分 - 希望你能找到一些东西:
I'm including the error relevant sections of the php.ini
file - hopefully you can find something:
error_reporting = E_ALL
error_log = "c:/wamp32/logs/php_error.log" ;(UNCOMMENTED BY ME)
log_errors = On
display_errors = On
推荐答案
;log_errors
只是对以下块的注释,目的是向您展示开发与生产中的设置.您取消了四行的注释,这些行并不意味着控制任何东西,我很惊讶您的 Apache 服务没有因此而启动问题.
The line ; log_errors
is just a comment for the following block, for the purpose of showing you what the settings are in dev vs production. You uncommented four lines which aren't meant to control anything, and I'm surprised your Apache service doesn't have problems starting up because of it.
您需要做的是寻找该行:
What you need to do is look for the line:
log_errors = Off
并将值更改为 On
也就是说,一旦您重新启动 Apache 服务,设置就会生效.但是,尽管有这些设置,我还是无法让 WampServer 正确记录 php 错误.当我指定 error_log
参数时,Apache 不会启动.
That said, once you restart the Apache service, the settings should take effect. However, I was unable to get WampServer to properly log php errors despite these settings. Apache will not start up when I specify the error_log
parameter.
这篇关于在 PHP 中使用 WAMP 服务器记录错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!