/contrib/famzah

Enthusiasm never stops

Print to STDERR in PHP

1 Comment

If you are writing a command line tool in PHP and want to write to STDERR, here is the command:

file_put_contents('php://stderr', 'This text goes to STDERR');

The relevant documentation page is PHP input/output streams.

P.S. I actually wanted to reply to this page, but there was no way to leave a comment there…

Unknown's avatar

Author: Ivan Zahariev

An experienced Linux & IT enthusiast, Engineer by heart, Systems architect & developer.

One thought on “Print to STDERR in PHP

  1. drench's avatar

    Hi, that’s my page that allows no comments. I used to have commenting through haloscan, but they shut down (or at least shut down their free service). Setting up Disqus has been on my to-do list for a long time.

    Thanks for the tip on file_put_contents()! I’ll update my page.

Leave a reply to drench Cancel reply