note 28586 deleted from function.exec by irchtml

From: Date: Wed, 25 Feb 2004 13:32:05 +0000
Subject: note 28586 deleted from function.exec by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65708@lists.php.net to get a copy of this message
Note Submitter: mimnermo00@hotmail.com ---- Hi all, i hope this is anybody useful. This simple script gives an output shell error if an error occurr in command placed in exec. = ) Carlitos <? ############# // $command="pwd"; // <--- this produces no uotput $command="ls -lazse"; //(bad command )<--- this produces, instead // an error in uotput ############# $command_null="$command>/dev/null"; echo "<h2>ERROR FROM EXEC</h2><br>$str<br>"; $str=exec($command_null,$arr,$err); $std_err="2>&1"; if ($err!=0){ echo "error:<br>"; $str=exec("$command $std_err",$arr,$err); echo "$str<br>"; } ?>

« previous php.notes (#65708) next »