Reputation: 13527
I use WAMP, and in my php.ini file I have:
error_log = "d:/php_error.log"
When I open that file, I see:
[26-Jun-2013 05:35:57 UTC] PHP Warning: Division by zero in D:\....
[26-Jun-2013 05:35:57 UTC] PHP Stack trace:
[26-Jun-2013 05:35:57 UTC] PHP 1. {main}() D:\....
[26-Jun-2013 05:35:57 UTC] PHP 2. Zend_Application->run()...
etc
The problem is that there are extra Carriage returns. I.e. I am expecting to rather have this:
[26-Jun-2013 05:35:57 UTC] PHP Warning: Division by zero in D:\....
[26-Jun-2013 05:35:57 UTC] PHP Stack trace:
[26-Jun-2013 05:35:57 UTC] PHP 1. {main}() D:\....
[26-Jun-2013 05:35:57 UTC] PHP 2. Zend_Application->run()...
etc
What could be causing this?
UPDATE
I changed "error_append_string" and "error_prepend_string" to "". I also checked and the entries after a line are:
[LINE]CR
CRLF
[LINE]CR
etc
I.e. Carriage Returns and LineFeed symbols...
Upvotes: 11
Views: 1310
Reputation: 2154
This might have something to do with syslog messing you up. So PHP adds the CR
, and then Windows' syslog goes in and puts an extra CRLF
in it when processing the log "line\n"
request.
See these related questions, where users had other problems with new line & error_log under other operating systems:
PHP error_log outputting line breaks as literal "\n" strings on Mac OSX
PHP error log and newline chars
In particular, this may happen when the user that Apache runs as does not have permission to write to the file, or the error_log
directive in your php.ini is unset (or defined as syslog
). More details here: http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log
As for the log file itself, you may try to experiment with it by giving it 777 permission, or creating the file yourself instead of letting the system create it (or vice-versa). Some users report different problems/solutions with each of these tweaks.
Upvotes: 3
Reputation: 3911
Don't set error_prepend_string
and error_append_string
, but rather disable them completly, by commenting them(;):
;error_prepend_string
and
;error_append_string
Upvotes: 2
Reputation: 398
You may want to check the values of
error_prepend_string
and
error_append_string
on your .ini file.
Upvotes: 1