down00112 2013-09-06 23:38
浏览 67
已采纳

无法获取PHP错误转到日志文件(Apache日志除外)

On a Ubuntu web server [LAMP], I'm trying to get PHP errors to write into a php_error file, but no matter what I do, they keep going to the apache log.

Here's what I have tried/done:

  1. Edited the php.ini file:

    • error_reporting = E_ALL | E_STRICT
    • display_error = Off
    • log_errors = On
    • error_log = /var/log/php_errors.log
  2. Restarted Apache

  3. Checked the phpinfo() output to verify that the changes I made to the php.ini file took -- they did.

  4. After verifying that the errors were still going to the Apache log, I physically created the php_errors.log and tried again. Still going to the Apache log!

  5. Rebooted the web server! Still...!

Anybody have a solution?

  • 写回答

2条回答 默认 最新

  • doupa2871 2015-03-19 00:59
    关注

    It had to do with ownership. One or the other has worked [for reasons that are not clear to me]:

    chown www-data:www-data /var/log/php_error.log
    
    chown same-user-as-www-home:same-user-as-web-home /var/log/php_error.log
    

    Also, the following has made a difference:

    chmod 664 /var/log/php_error.log
    

    [as opposed to chmod 644...again for reasons that are not clear to me]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog