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 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图