note 35917 deleted from function.exec by danbrown
| From: | danbrown@php.net | Date: | Sun, 04 Jan 2009 16:32:57 +0000 |
| Subject: | note 35917 deleted from function.exec by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148814@lists.php.net to get a copy of this message | ||
Note Submitter: zitan at mediasculpt dot net
----
If you're wondering how to catch error messages when calling exec, you simply need to use
2>&1 at the end of your command, and then error messages will get populated into your $output
string (i.e. STDERR to STDOUT).
<?
exec("$cmd 2>&1", $output);
echo $output;
foreach($output as $outputline){
echo("$outputline<br>");
}
?>