In PHP, you can execute a command and obtain the return code using exec
.
The manual for exec
says the third parameter is a variable in which the return code will be stored, for example
exec('python blibble.py', $output, $ret_code);
$ret_code
will be the shell return code, and $output
is an array of the lines of text printed to std. output.
This does appear to be an appropriate use for a return code from what you described, i.e. 0 indicating success, and >0 being codes for various types of errors.