Re: redirect stdout and stderr to PHP variables? [message #176816 is a reply to message #176799] |
Wed, 25 January 2012 22:25 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 1/25/2012 2:47 PM, crankypuss wrote:
> I'm sure there's a way to do this, probably some simple syntax I've not
> run into and am too stupid to find in the manual or through google-fu or
> otherwise.
>
> I'd like to issue an arbitrary shell command in a subroutine and have it
> return an array that contains one element representing stdout and
> another element representing stderr.
>
> For example, using tar to deal with a bazillion files, error messages
> might not be seen when specifying verbose output; I'd like to collect
> them and display after stdout.
>
> I've not found any syntax, yet, for redirecting to a PHP variable rather
> than some file.
>
> tia.
Take a look at the proc_open(). The examples show how do return stdout
and stderr in separate streams.
It may be more than you need (this is made to be interactive between the
PHP script and the process), but you don't HAVE to send data to the process.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|