2010-03-03 49 views
3

我得到了一個運行web服務器和老版本的gambio(xt:commerce fork)。 public_html上的dir中的error_log氾濫出錯。 15分鐘約30mb。 如何禁用此日誌? 我無法修復所有錯誤。 下面是錯誤的幾個例子:禁用error_log。 Error_log flooding

[warn] mod_fcgid: stderr: PHP Notice: Undefined variable: key in /usr/www/users/foo//includes/classes/class.inputfilter.php on line 98 
[warn] mod_fcgid: stderr: PHP Notice: Undefined index: in /usr/www/users/foo/templ 
[warn] mod_fcgid: stderr: in /usr/www/users/foo/templates/gambio/source/inc/xtc_show_category_sectionc.inc.php on line 47 

他們的所有錯誤:「mod_fcgid:標準錯誤」。我試圖在公共HTML目錄中grep「error_log」和「error_report」,但我沒有找到任何東西。

下面是從的phpinfo(部分):

PHP Version 4.4.9 

System Linux foobar.com 2.6.26-2-686-bigmem #1 SMP Sat Dec 26 09:26:36 UTC 2009 i686 
Build Date Feb 11 2010 13:00:33 
Configure Command './configure' '--prefix=/usr/local/php4' '--with-config-file-path=/etc/php4/cgi' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-tiff-dir' '--with-ttf' '--enable-force-cgi-redirect' '--enable-safe-mode' '--with-zlib' '--enable-ftp' '--enable-url-includes' '--enable-gd-native-ttf' '--enable-trans-sid' '--enable-dbase' '--with-db4' '--with-ldap' '--enable-bcmath' '--enable-calendar' '--enable-memory-limit' '--with-mcal=/usr' '--with-bz2' '--with-mod-dav' '--enable-sockets' '--with-kerberos' '--with-imap-ssl' '--enable-gd-imgstrttf' '--with-freetype-dir' '--with-curl' '--with-mysql' '--with-mhash' '--with-gdbm' '--with-pgsql' '--with-gettext' '--with-xml' '--with-mcrypt' '--with-openssl' '--with-dom' '--without-pear' '--enable-exif' '--with-zip' '--enable-wddx' '--disable-cli' '--enable-fastcgi' '--with-imap' '--enable-xslt' '--with-xslt-sablot=/usr/local/lib' '--enable-mbstring' '--with-dom-xslt' '--with-dom-exslt' 
Server API CGI/FastCGI 
Virtual Directory Support disabled 
Configuration File (php.ini) Path /home/httpd/php-ini/foo/php.ini 
PHP API 20020918 
PHP Extension 20020429 
Zend Extension 20050606 
Debug Build no 
Zend Memory Manager enabled 
Thread Safety disabled 
Registered PHP Streams php, http, ftp, https, ftps, compress.bzip2, compress.zlib 


**Configuration 

PHP核心**

Directive Local Value Master Value 
allow_call_time_pass_reference On On 
allow_url_fopen Off Off 
always_populate_raw_post_data Off Off 
arg_separator.input & & 
arg_separator.output & & 
asp_tags Off Off 
auto_append_file no value no value 
auto_prepend_file no value no value 
browscap no value no value 
default_charset no value no value 
default_mimetype text/html text/html 
define_syslog_variables Off Off 
disable_classes no value no value 
disable_functions no value no value 
display_errors On On 
display_startup_errors Off Off 
doc_root no value no value 
docref_ext no value no value 
docref_root no value no value 
enable_dl On On 
error_append_string no value no value 
error_log no value no value 
error_prepend_string no value no value 
error_reporting 2039 2039 
expose_php On On 
extension_dir /usr/local/php4/lib/php/extensions/no-debug-non-zts-20020429 /usr/local/php4/lib/php/extensions/no-debug-non-zts-20020429 
file_uploads On On 
gpc_order GPC GPC 
highlight.bg #FFFFFF #FFFFFF 
highlight.comment #FF8000 #FF8000 
highlight.default #0000BB #0000BB 
highlight.html #000000 #000000 
highlight.keyword #007700 #007700 
highlight.string #DD0000 #DD0000 
html_errors On On 
ignore_repeated_errors Off Off 
ignore_repeated_source Off Off 
ignore_user_abort Off Off 
implicit_flush Off Off 
include_path .:/usr/local/lib/php/ .:/usr/local/lib/php/ 
log_errors Off Off 
log_errors_max_len 1024 1024 
magic_quotes_gpc On On 
magic_quotes_runtime Off Off 
magic_quotes_sybase Off Off 
max_execution_time 120 120 
max_input_nesting_level 500 500 
max_input_time -1 -1 
memory_limit 128000000 128000000 
open_basedir /usr/www/users/foo:/usr/home/foo:/tmp:/usr/local/lib/php:/usr/local/rmagic:/usr/www/users/he/_system_ /usr/www/users/foo:/usr/home/foo:/tmp:/usr/local/lib/php:/usr/local/rmagic:/usr/www/users/he/_system_ 
output_buffering no value no value 
output_handler no value no value 
post_max_size 128000000 128000000 
precision 14 14 
register_argc_argv On On 
register_globals Off Off 
report_memleaks On On 
safe_mode Off Off 
safe_mode_exec_dir no value no value 
safe_mode_gid Off Off 
safe_mode_include_dir no value no value 
sendmail_from no value no value 
sendmail_path /usr/sbin/sendmail -t /usr/sbin/sendmail -t 
serialize_precision 100 100 
short_open_tag On On 
SMTP localhost localhost 
smtp_port 25 25 
sql.safe_mode Off Off 
track_errors Off Off 
unserialize_callback_func no value no value 
upload_max_filesize 128000000 128000000 
upload_tmp_dir /usr/foo/foo/.tmp /usr/foo/.tmp 
user_dir no value no value 
variables_order EGPCS EGPCS 
xmlrpc_error_number 0 0 
xmlrpc_errors Off Off 
y2k_compliance Off Off 

回答

6

在php.ini集 「的display_errors」 爲0,如果不工作設置「error_reporting」爲0或「E_ERROR」,這樣你至少可以得到記錄的真正嚴重錯誤。

如果不這樣做的伎倆請評論:)

5

對於在類似情況下任何人,但誰沒有訪問和修改php.ini - 或誰不能重新啓動Apache重新加載PHP配置 - 可以爲PHP腳本的運行時更改日誌的詳細程度。見PHP manual on error_reporting

// Prevent this buggy script filling the logs with all its error messages 
error_reporting(0); 

如果PHP錯誤信息的報告已經減少或通過php.ini管理員全局禁止,但你需要看的警告,同時修改/調試一個特定的PHP腳本:

// Report all levels of PHP error message for this script only 
error_reporting(E_ALL);