error_log文件每天生成1 GB的数据文本,我如何解决这个问题


error_log file generates 1 GB data text everyday how do I solve this issue

我有一些error_log文件的问题。每天生成1gb的数据文件。每天早上我需要通过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

有两种明显的方法可以使给定的消息不再显示在日志中:

  • 修复导致此错误的错误
  • 不要记录

这个bug本身相当简单。PHP有几种类型的标识符:

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

你可能把常量语法用在了应该是字符串的东西上。

作为日志记录,您希望更改error_reporting指令并使其省略E_NOTICE。一般来说,应该在开发服务器中注意这些通知。如果它们到达生产,没有人会检查日志并修复它们。

这些错误只是注意事项。如果开发人员在开发时没有修复它们,并且您不想联系他,只需打开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