Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
810 views
in Technique[技术] by (71.8m points)

apache - 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.

error_log(print_r(array(1,2,4),1));

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

[Thu Jul 30 11:32:34 2009] [error] [client 118.93.246.104] Array
(
    [0] => 1
    [1] => 2
    [2] => 4
)
, referer: http://dev.example.org/

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).

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

Details:

error_log function

error_log directive


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...