Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

[email protected] ("Jan G.B.")
Newsgroups php.general
Message-ID <[email protected]>
2010/3/23 Daniel Egeberg <[email protected]>

> On Tue, Mar 23, 2010 at 11:47, Marten Lehmann <[email protected]> wrote:
> > Hello,
> >
> > I found different code examples like this, which use the file handle
> STDERR
> > just like this:
> >
> > <?php
> > fwrite(STDERR, "hello\n");
> > ?>
> >
> > Also, the PHP documentation of input/output streams
> > (http://php.net/manual/de/wrappers.php.php) says:
> >
> > "It is recommended that you simply use the constants STDIN, STDOUT  and
> > STDERR instead of manually opening streams using these wrappers."
> >
> > I don't want to use the "php://stderr" wrapper, because this just creates
> a
> > duplicate of the original STDERR handler and if I'm closing
> "php://stderr",
> > the original STDERR still would exist.
> >
> > When I'm using this code, I only get:
> >
> > <b>Notice</b>:  Use of undefined constant STDERR - assumed 'STDERR' in
> > <b>/test.php</b> on line <b>4</b><br />
> > <br />
> > <b>Warning</b>:  fwrite(): supplied argument is not a valid stream
> resource
> > in <b>/test.php</b> on line <b>4</b><br />
> >
> > How can I access the original STDERR handle? The constant should be
> there,
> > but does not exist.
> >
> > regards
> > Marten
>
> These I/O streams are only present in the CLI SAPI.
>
> --
> Daniel Egeberg
>
> Please confirm that the code of my previous replay on this topic (executed
via php-cli) does not print out "test2" or "test3". The constant is present
but doesn't work as supposed.

Regards
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.