PHP exec function no output

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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

Quoted text here. Click to load it

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);

Site Timeline