Redirecting STDERR

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Redirecting STDERR

Post 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.
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post 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.
Post Reply