Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: PHP Error Logging Issues
PostPosted: Tue Mar 10, 2009 7:57 pm 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
OK, having some very frustrating error loggin issues on one of my linodes... it's my production server.

So, I don't want any errors displayed, but want them logged.

My php.ini file error settings:

Code:
error_reporting = E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = On
error_log = /log/php/error.log


So, rebooting apache2 with this reveals in phpinfo that these settings are indeed being picked up by php.

Code:
allow_call_time_pass_reference   On   On
allow_url_fopen   Off   Off
allow_url_include   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_globals_jit   On   On
auto_prepend_file   no value   no value
browscap   no value   no value
default_charset   UTF-8   UTF-8
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   Off   Off
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   /log/php/error.log   /log/php/error.log
error_prepend_string   no value   no value
error_reporting   2048   2048
expose_php   Off   Off
extension_dir   /usr/lib/php5/20060613+lfs   /usr/lib/php5/20060613+lfs
file_uploads   Off   Off
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   On   On
implicit_flush   Off   Off
include_path   .:/usr/share/php:/usr/share/pear   .:/usr/share/php:/usr/share/pear
log_errors   On   On
log_errors_max_len   1024   1024
magic_quotes_gpc   On   On
magic_quotes_runtime   Off   Off
magic_quotes_sybase   Off   Off
mail.force_extra_parameters   no value   no value
max_execution_time   30   30
max_input_time   60   60
memory_limit   16M   16M
open_basedir   no value   no value
output_buffering   no value   no value
output_handler   no value   no value
post_max_size   8M   8M
precision   12   12
realpath_cache_size   16K   16K
realpath_cache_ttl   120   120
register_argc_argv   On   On
register_globals   Off   Off
register_long_arrays   Off   Off
report_memleaks   On   On
report_zend_debug   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 -i    /usr/sbin/sendmail -t -i
serialize_precision   100   100
short_open_tag   Off   Off
SMTP   localhost   localhost
smtp_port   25   25
sql.safe_mode   Off   Off
track_errors   On   On
unserialize_callback_func   no value   no value
upload_max_filesize   2M   2M
upload_tmp_dir   no value   no value
user_dir   no value   no value
variables_order   EGPCS   EGPCS
xmlrpc_error_number   0   0
xmlrpc_errors   Off   Off
y2k_compliance   On   On
zend.ze1_compatibility_mode   Off   Off


No, I wanted to make sure that php can write to the custom error.log, so I touch error.log as root, and then go and chown error.log to www-data, which is the apache2 user on my debian5 box.

chown www-data:www-data error.log
chmod 640 error.log

reboot apache2 again and now, on my production server trying to generate an error in test.php.

<?php

$test = true;
while($test) {
echo 'test';

?>

So, the unclosed while loop should generate an error. Nothing is displayed, great! Now, check the error.log... nothing. file is 0 bytes.

I'm stuck, and extremely frustrated... any ideas!?

Thanks,

Paul
Code:


Top
   
 Post subject:
PostPosted: Wed Mar 11, 2009 12:44 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Is apache waiting until it has a sufficiently large number of error messages, so that it can flush them to disk all at once? I've seen it happen with other programs, not sure about apache.

And why /log/php/error.log instead of the standard /var/log/apache2/whatever?


Top
   
 Post subject:
PostPosted: Wed Mar 11, 2009 1:57 am 
Offline
Junior Member

Joined: Thu Jul 19, 2007 5:30 am
Posts: 28
hybinet wrote:
And why /log/php/error.log instead of the standard /var/log/apache2/whatever?


Yeah, whenever you try to debug something try to take out as many variables as possible. Try to get PHP logging to the default place and make sure that works before you change something else. Also, do check out the apache error log, probably /var/log/(apache2|httpd)/error_log and standard syslog (/var/log/messages or some such). If the logs aren't showing up in the desired place, perhaps PHP's defaulting to its default log destination. It doesn't fully solve the problem, but at least it gets you one step closer.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group