I'm trying to execute a python script using php with an exec command like this:
The script could still be executing some cleanup code, or you could be calling
sys.exit() from a child process which will essentially be calling
thread.exit(), leaving the parent process running.
Check that the
sys.exit() call is in the main part of the script and that no error handling is interfering with the
SystemExit exception, or alternatively you could try
os._exit(). Also ensure that an ampersand (
&) is not present within the command passed to
exec() as this will cause the script to run as a background process.
os._exit() is not favourable since it doesn't do any cleanup, and essentially ends the process immediately.
Edit To end the script from within your
try block you could do something like this:
try: # Existing Code except SysExit: sys.exit() # quit the main thread except: # Existing error handling