error_log文件每天生成1 GB数据文本如何解决此问题

时间:2014-07-12 10:56:12

标签: php web error-log

我在error_log文件中遇到了一些问题。它每天生成1 GB的数据文件。每天早上我需要通过FTP登录删除此文件。由于这个大的内存有时我无法访问我的网站。它说内部服务器错误。

如何解决此error_log文件问题。

[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/listing_list_item.php on line 20
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/listing_list_item.php on line 20
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Undefined offset: 0 in /home/inseedo/public_html/include/template/listing_list_item.php on line 37
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/listing_list_item.php on line 20
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Undefined offset: 0 in /home/inseedo/public_html/include/template/listing_list_item.php on line 37
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/listing_list_item.php on line 20
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/listing_list_item.php on line 20
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/listing_list_item.php on line 20
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/site_panel_listings.php on line 92
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/site_panel_listings.php on line 92
[12-Jul-2014 10:52:10 UTC] PHP Notice:  Use of undefined constant location_name_zip - assumed 'location_name_zip' in /home/inseedo/public_html/include/template/site_panel_listings.php on line 92

2 个答案:

答案 0 :(得分:3)

有两种显而易见的方法可以让某条消息停止显示在日志中:

  • 修正导致错误的错误
  • 不要记录

错误本身相当直截了当。 PHP有几种标识符:

  • 变量:$foo
  • 常数:foo
  • 字符串:'foo'

您可能会使用常量语法来表示字符串。

截至日志记录时,您要更改error_reporting directive并将其省略E_NOTICE。通常,应在开发服务器中处理注意事项。如果他们达到生产,没有人会检查日志并修复它们。

答案 1 :(得分:-2)

这些错误只是通知。如果开发人员在开发时没有修复它们,并且您不想与他联系,只需转动Off PHP的log_errors指令即可。例如:

#Add this line to .htaccess
php_flag log_errors Off

; or in php.ini find following line and change it
log_errors=Off