I'm testing the php exec command:
and I'm getting back a result code of 127.
My php code is:
<?
print "<br>executing 'hello':<br><b>";
exec ("hello", $output, $result);
var_dump($output);
print "<br>$result";
print "<br></b>end hello.";
print "<br><hr><br>";
print "<br>executing 'dir':<br><b>";
exec("dir", $output2, $result2);
var_dump($output2);
print "<br>$result2";
print "<br></b>end dir.";
?>
And the output is:
executing 'hello':
array(0) { }
127
end hello.
executing 'dir':
array(2) { [0]=> string(42) "bs1.jpg hello index.htm ml1_1.jpg pp1.jpg" }
0
end dir.
The php documentation (as far as I could find) says this:
return_var
If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable.
...but does not have a list of output possibilities or a way to look them up.
Any suggestions?
Return codes can be a bit arbitrary. Basically though, any non-zero return value is an error. Here's a list of some common ones, but typically, unless you're working with a specific program, it's easier to just assume non-zero = some error was found, as opposed to trying to map a number of different programs to specific error codes.