php exec python script not working [Solved]

When you use exec in php to call shells like python, perl or other script. please follow the step below for your debugging:

exec("$your_command_here 2>&1", $output, $return_status);

the “2>&1” is the key point for debugging, because it can redirect the error message to standard output. Also, when you shell encounter an error, the $return_status will be 1 (success with 0).

Leave a Reply