Thursday, November 03, 2011

PHP and writing to Apache logs

Printing to STDERR is quite easy, once you figure it out!

file_put_contents('php://stderr', print_r($your_string, TRUE));

Of course, you can also replace 'stderr' with 'stdout'.

You could also use error_log but it truncates long strings ...