I want to have a PHP program call a python program and have it run the background.  When I call this from the shell nohup python3 automation.py args >/dev/null 2>&1 & , everything runs fine.  I run top and jobs and I can see that it is executing.  The script finishes successfully.
Now I would like this script to be called from a PHP program and then run in the background, so I am using this command, which is the same above.  For the program not to hang, I output it to null.
exec('nohup python3 automation.py args >/dev/null 2>&1 &')
Everything runs fine for awhile when I administer a top but then it dies after a few seconds and I am left scratching my head to figure out why.  How do I troubleshoot this?
Problem solved.  The linux user that PHP is used when commands are executed is www-data.  That user didn't have write permissions for the file.  To log in as www-data for testing, run this su -s /bin/bash www-data.  Any command you execute in the shell should be equivalent to calling it from PHP.
Why is my python script dying in the background when called from PHP?