How can I run a program in the background (non blocking) with php?

前端 未结 1 836
再見小時候
再見小時候 2021-01-07 02:58

I want to run a shell script in php, but this shell script takes a long time to execute (it has sleep in it), I don\'t want the web server to block when executing this scrip

相关标签:
1条回答
  • 2021-01-07 03:53

    I solved the problem by adding

    "> /dev/null 2>/dev/null &"
    

    after the script name to the shell_exec() php function

    Thanks

    0 讨论(0)
提交回复
热议问题