note 28586 added to function.exec

From: Date: Fri, 17 Jan 2003 13:47:44 +0000
Subject: note 28586 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-42271@lists.php.net to get a copy of this message
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>"; } ?> -- http://www.php.net/manual/en/function.exec.php http://master.php.net/manage/user-notes.php?action=edit+28586 http://master.php.net/manage/user-notes.php?action=delete+28586 http://master.php.net/manage/user-notes.php?action=reject+28586

« previous php.notes (#42271) next »