Filtering all output to STDERR
Filtering all output to STDERR
am 22.03.2010 18:01:52 von Marten Lehmann
Hello,
we have a strange problem here:
- Our ISP is merging STDERR and STDOUT to STDOUT
- We are calling a non-builtin function within PHP 5.2 which includes a
lot of code and calls a lot of other functions
- When calling this function, we receive the output "Cannot open " on
STDERR. But since STDERR and STDOUT are merged, this "Cannot open "
breaks the required HTTP-header which needs to be sent first.
We really tried a lot to find out where this message comes from, we even
used strace and ran PHP on the command line. But we cannot figure out
the origin, so all we want to do is to get rid of the output sent to STDERR.
We tried to close STDERR, but it didn't work out.
We thought of using ob_start() and ob_end_clean(), but we cannot get it
working with STDERR. Any ideas?
Kind regards
Marten
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Filtering all output to STDERR
am 22.03.2010 18:12:15 von Peter Lind
You could consider suppressing errors for the duration of the
problematic call - if indeed you're looking at a warning that doesn't
grind everything to a halt.
On 22 March 2010 18:01, Marten Lehmann wrote:
> Hello,
>
> we have a strange problem here:
>
> - Our ISP is merging STDERR and STDOUT to STDOUT
> - We are calling a non-builtin function within PHP 5.2 which includes a lot
> of code and calls a lot of other functions
> - When calling this function, we receive the output "Cannot open " on
> STDERR. But since STDERR and STDOUT are merged, this "Cannot open " breaks
> the required HTTP-header which needs to be sent first.
>
> We really tried a lot to find out where this message comes from, we even
> used strace and ran PHP on the command line. But we cannot figure out the
> origin, so all we want to do is to get rid of the output sent to STDERR.
>
> We tried to close STDERR, but it didn't work out.
>
> We thought of using ob_start() and ob_end_clean(), but we cannot get it
> working with STDERR. Any ideas?
>
> Kind regards
> Marten
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Filtering all output to STDERR
am 22.03.2010 23:56:34 von Marten Lehmann
Hello,
> You could consider suppressing errors for the duration of the
> problematic call
yes, but how?
Regards
Marten
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Filtering all output to STDERR
am 23.03.2010 00:00:31 von Peter Lind
Have you tried with
http://dk2.php.net/manual/en/function.error-reporting.php or just the
@ operator?
On 22 March 2010 23:56, Marten Lehmann wrote:
> Hello,
>
>> You could consider suppressing errors for the duration of the
>> problematic call
>
> yes, but how?
>
> Regards
> Marten
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Filtering all output to STDERR
am 23.03.2010 11:28:29 von Marten Lehmann
> Have you tried with
> http://dk2.php.net/manual/en/function.error-reporting.php or just the
> @ operator?
Yes. But this does not work, because error levels and the @ operator
only relate to errors thrown by the PHP runtime and have nothing to do
with STDERR.
But I need a way to close the STDERR file handle at the beginning of a
script or at least catch and remove all output sent to STDERR.
Regards
Marten
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Filtering all output to STDERR
am 23.03.2010 12:16:34 von Peter Lind
Ahh, I see why my suggestions had no effect - I assumed you were
dealing with normal php errors, not something done customly by the
code.
I'm afraid the only option I see is that of debugging the problem
script to find out where it opens STDERR - if you're certain that the
script specifically outputs messages to STDERR, then it's opening that
stream somewhere before the output.
Regards
Peter
On 23 March 2010 11:28, Marten Lehmann wrote:
>> Have you tried with
>> http://dk2.php.net/manual/en/function.error-reporting.php or just the
>> @ operator?
>
> Yes. But this does not work, because error levels and the @ operator only
> relate to errors thrown by the PHP runtime and have nothing to do with
> STDERR.
>
> But I need a way to close the STDERR file handle at the beginning of a
> script or at least catch and remove all output sent to STDERR.
>
> Regards
> Marten
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php