【问题标题】:PHP and Apache - how do I stop having so much stuff written to logsPHP 和 Apache - 我如何停止将这么多东西写入日志
【发布时间】:2012-05-22 01:21:06
【问题描述】:

我有一个有点过时的托管公司。我有一个 PHP/Apache 设置。

由于某种原因,它不断向日志文件写入大量内容。有两个日志文件:

access_log 和 error_log

我从不查看访问日志,那么是否有一些可以打开或关闭的 apache 配置会停止对访问日志的所有写入?

对于error_log,我非常随机地得到了很多东西。

[Sun May 20 00:56:28 2012] [error] [client 92.96.145.124] PHP Notice:  Undefined index:  photo_path in /home/webadmin/problemio.com/html/utils/api/somefile.php on line 398
[Sun May 20 00:56:28 2012] [error] [client 92.96.145.124] PHP Notice:  Undefined index:  photo_path in /home/webadmin/problemio.com/html/utils/api/somefile.php on line 398

但那些是通知。我怎样才能让它显示警告和错误?

谢谢!!

【问题讨论】:

标签: php apache


【解决方案1】:

在页面/标题的顶部包含这两个之一,这应该注意通知(根据您想看到的内容)。

// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

【讨论】:

  • 谢谢!这很有帮助。但是有没有办法在设置/配置中做到这一点?
  • 你的 php.ini 文件中应该有一个错误报告字段,适用的值都在这里列出:php.net/manual/en/errorfunc.constants.php
【解决方案2】:

我曾经面临同样的问题。我问了CS,他们只是回答“不能”。我最终编写了一个 cron 脚本来删除那些垃圾文件。

【讨论】:

  • 听起来很糟糕 :) 实际上,我认为将这些内容写入文件系统需要大量资源,所以我真的需要它根本不发生。
【解决方案3】:

此变量在未定义时正在使用

第 398 行 /home/webadmin/problemio.com/html/utils/api/somefile.php 中的照片路径

您需要找到该文件。发现错误。

【讨论】:

    猜你喜欢
    • 2020-02-19
    • 1970-01-01
    • 2012-06-18
    • 2013-04-09
    • 2011-02-26
    • 1970-01-01
    • 2014-09-06
    • 2020-08-16
    • 2020-06-21
    相关资源
    最近更新 更多