【发布时间】:2015-08-02 23:18:38
【问题描述】:
我正在尝试记录所有错误,但由于某种原因我无法让它工作!如果我在我的 .htaccess 中打开 display_errors,那么错误就会在这里和那里弹出。但我不想让它们显示出来,而是希望将它们放在我可以阅读的日志中,这样我的用户就不会看到错误。
我已将这些添加到我的 .htaccess 文件中:
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /path/to/errors.txt
php_value error_reporting 32767
php_value log_errors_max_len 2048
然而errors.log 仍然是空的!我试过重新启动apache,整个服务器,什么都没有。任何帮助将不胜感激。
PHP 版本 - 5.4.39-0+deb7u2
【问题讨论】:
-
你确定 "/path/to/errors.txt" 可以被运行 apache 的用户写入,例如用户阿帕奇?
-
@Jobst 到底是什么问题!感谢您和 The Humble Rat 指出这一点,也感谢 Humble Rat 如此详细的回复
标签: php apache .htaccess error-handling error-logging