开发者

execute bash script from php without waiting

开发者 https://www.devze.com 2023-02-19 17:53 出处:网络
I execute a bash script from php with shell_exec. But the php script waits until the shell s开发者_开发百科cript is finished.

I execute a bash script from php with shell_exec. But the php script waits until the shell s开发者_开发百科cript is finished.

Can I somehow call the bash script without waiting. Both:

exec
shell_exec

are waiting until the bash script is finished. I'm running linux btw.


This has to work:

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


when calling your bash script append & so it will run in the background that's the easiest way if you don't need any output

shell_exec("/bin/bash /path/to/script.sh &"); 
0

精彩评论

暂无评论...
验证码 换一张
取 消