Page 1 of 1

Redirecting STDERR

Posted: Tue Jun 14, 2005 7:02 am
by onion2k
Something I use occasionally in Perl is a bit of code that redirects the STDERR stream to a file instead of its usual destination:

Code: Select all

open STDERR, &quote;>>errors.txt&quote; or die &quote;Can't redirect STDERR: $!&quote;;
Is there a way to do something similar in PHP? I've looked at writing a custom error handler with set_error_handler(), but I can't get it to work with anything other than simple warnings. I really need to capture *every* error to somewhere other than the usual log.

Posted: Tue Jun 14, 2005 7:09 am
by Syranide
the error handler can only capture errors that is caused by at run-time. all others cannot be dealt with (as your error handler hasn't even started).

and generally, this is not something one should care about as these errors cannot appear without modification. meaning that if you don't see these errors... then they won't appear unless you modify something.

so no there is no such thing IN php.