How to know a code in php run sucessfully or not -
i have fallowing code
<html> <body> <?php if ($_get['run']) { # code run if ?run=true set. echo "hello"; exec ("chmod a+x ps.sh"); exec ("sh ps.sh"); } ?> <!-- link add ?run=true url, myfilename.php?run=true --> <a href="?run=true">click me!</a>
now want know exec ("chmod a+x ps.sh")
executing or not. should do??
exec(..., $output, $return); if ($return != 0) { // went wrong }
capture return code supplying variable name third parameter. if variable contains 0
afterwards, good. if it's other 0
, went wrong.
Comments
Post a Comment