note 35917 added to function.exec
| From: | zitan at mediasculpt dot net | Date: | Fri, 19 Sep 2003 02:19:57 +0000 |
| Subject: | note 35917 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56738@lists.php.net to get a copy of this message | ||
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>");
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35917
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35917&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35917&report=yes