Re: redirect stdout and stderr to PHP variables? [message #176807 is a reply to message #176805] |
Thu, 26 January 2012 09:27 |
crankypuss
Messages: 147 Registered: March 2011
Karma:
|
Senior Member |
|
|
On 01/26/2012 02:00 AM, Tim Streater wrote:
> In article <jfr340125sq(at)news4(dot)newsguy(dot)com>,
> crankypuss <no(at)email(dot)thanks> wrote:
>
>> On 01/25/2012 03:53 PM, crankypuss wrote:
>>> On 01/25/2012 02:46 PM, M. Strobel wrote:
>>>> php> $res1 = exec('rm this-does-really-not-exist.php 2>&1', $a, $rc);
>>>> php> echo $rc;
>>>> 1
>>>> php> print_r($a);
>>>> Array
>>>> (
>>>> [0] => rm: Entfernen von „this-does-really-not-exist.php“ nicht
>>>> möglich: Datei
>>>> oder Verzeichnis nicht gefunden
>>>> )
>>>> php>
>>>
>>> Thanks, will try these in the morning.
>>
>> BTW, where is this syntax documented? I'd prefer understanding it to
>> using magic.
>
> Which syntax, exactly? exec is documented in the PHP online docs.
Sorry, I've been unable to find the bit about redirecting stdout and
stderr to PHP variables, can you point me to that? Yes, exec() provides
an optional &$output argument which in effect redirects stdout to the
varialble, but I see no way to obtain stderr separately. Thanks.
|
|
|