PHP exec function no output
am 28.10.2007 20:27:52 von Ryan Hubbard
I am running PHP 5.1.6 (cli) on Linux. When i use the exec($cmd,
$output, $return) command the $output array is always blank if the
command had an error in it. There are only values if the command was
successful. How do I capture the error text returned?
Re: PHP exec function no output
am 28.10.2007 21:29:54 von zeldorblat
On Oct 28, 3:27 pm, "ryanm...@yahoo.com" wrote:
> I am running PHP 5.1.6 (cli) on Linux. When i use the exec($cmd,
> $output, $return) command the $output array is always blank if the
> command had an error in it. There are only values if the command was
> successful. How do I capture the error text returned?
There's a comment in the manual on exec() that explains this. Since
you couldn't find it (or didn't look) I'll paste it here.
$command = 'your command goes here';
$output = exec($command . ' 2>&1', $output, $return);