exec() with timeout

后端 未结 7 1078
北荒
北荒 2020-12-03 04:27

I\'m looking for a way to run a PHP process with a timeout. Currently I\'m simply using exec(), but it does not provide a timeout option.

What I also tried is openin

7条回答
  •  佛祖请我去吃肉
    2020-12-03 04:51

    You could fork() and then exec() in one process and wait() non-blocking in the other. Also keep track of the timeout and kill() the other process if it does not finish in time.

提交回复
热议问题