Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无需等待即可从php执行bash脚本_Php_Bash - Fatal编程技术网

无需等待即可从php执行bash脚本

无需等待即可从php执行bash脚本,php,bash,Php,Bash,我使用shell_exec从php执行bash脚本。 但是php脚本将等待shell脚本完成 我可以不用等待就调用bash脚本吗。 两者: 正在等待bash脚本完成。 顺便说一句,我正在运行linux。在调用bash脚本append时&因此它将在后台运行 如果不需要任何输出,这是最简单的方法 shell_exec("/bin/bash /path/to/script.sh &"); 这必须起作用: exec('/your/command/dev/null 2>/dev/null&')

我使用shell_exec从php执行bash脚本。 但是php脚本将等待shell脚本完成

我可以不用等待就调用bash脚本吗。 两者:

正在等待bash脚本完成。
顺便说一句,我正在运行linux。

在调用bash脚本append时&因此它将在后台运行 如果不需要任何输出,这是最简单的方法

shell_exec("/bin/bash /path/to/script.sh &"); 
这必须起作用:


exec('/your/command/dev/null 2>/dev/null&')

到底是什么不起作用?在后台运行?剧本?可能是权限问题PHP还在等待脚本执行。“sh command>/dev/null 2>&1&”完成了这个技巧。感谢您的帮助:)好的,几乎最终的解决方案是
sh命令>/dev/null 2>&1&
谢谢您的输入
shell_exec("/bin/bash /path/to/script.sh &");