【发布时间】:2011-06-23 05:22:06
【问题描述】:
我想有很多类似的帖子,但我搜索了一下还没有找到解决方案。
基本上,我试图在后台运行两个脚本。当我在命令行中运行它们时,我在调用我的第一个脚本后看到:
/usr/bin/nohup php script.php > nohupoutput.log & echo $!
我尝试过...script.php > /dev/null &,结果相同。我明白了:
/usr/bin/nohup: ignoring input and redirecting stderr to stdout
我忽略并运行第二个。我注意到它似乎挂在那里,按 Enter 将我带回 machine:~folder>
/usr/bin/nohup php script2.php > nohupoutput.log & echo $!
两个脚本都有效。然后我尝试将其转换为 shell_exec 命令,但似乎没有任何效果。我怀疑ignoring input 位会造成困难,但我不确定。无论如何,以下不起作用。它只是挂在浏览器中:
$output = shell_exec('/usr/bin/nohup php script.php > /dev/null &');
$output = shell_exec('/usr/bin/nohup php script2.php > /dev/null &');
【问题讨论】:
标签: php exec shellexecute shell-exec nohup