参考
https://stackoverflow.com/questions/4929827/shell-exec-php-with-nohup
红色部分为关键点。
nohup /usr/bin/php /mytask/task1.php >/mytask/nohup/task1.log 2>&1 &
Shell_exec php with nohup
原文:https://www.cnblogs.com/coffee_cn/p/12101364.html