PHP write to STDERR

I'm using PHP at the command line to write a bunch of SQL commands out. If an error arose I wanted it to go to STDERR instead of being printed out and messing up my SQL. PHP, being a web based language, doesn't make this real obvious. The solution ended up being error_log(), which if called from the CLI sends a message to STDERR.

error_log("This message will go to STDERR");

In web context error_log() logs to Apache's error_log, where ever that is mapped.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 54.80.249.22
To prevent spam please submit by clicking the kitten: