Chris Burgess Chris Burgess - 1 year ago 73
PHP Question

PHP error log and newline chars

What's the PHP config setting which allows or prevents newlines in debug output from being escaped?

On two different installs (a dev laptop running MAMP/OSX, and a dev server running debian) I see different results in the error logs when debugging.


On Debian this appears in /var/log/apache2/error.log as

[Thu Jul 30 11:32:34 2009] [error] [client] Array\n(\n [0] => 1\n [1] => 2\n [2] => 4\n)\n, referer:

On OSX this appears in /Applications/MAMP/logs/php_error_log as

[30-Jul-2009 11:34:00] Array
[0] => 1
[1] => 2
[2] => 4

I prefer the MAMP way for debugging (apart from relocating logfiles to the /Applications directory).


Answer Source

Chris, you should be able to change the error_log directive in your php.ini on Debian to point to a file. If this is undefined, it will go through syslog which doesn't support multiple lines.


error_log function

error_log directive

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download