Don't wait for the process to exit

2020-02-07 06:42发布

I have a PHP script that is called from a cron job every minute. This script takes some info from the database and then calls another PHP script using the System function (passing it some parameters).

That means that I can start up to 10 scripts from this "main" one. And what I would like to do is that I would call the script and continue the execution of the main script, that is, not wait for the System call to complete and then call the next one.

How can this be done?

标签: php
7条回答
家丑人穷心不美
2楼-- · 2020-02-07 07:25

http://php.net/pcntl_fork

It's *NIX only but you can fork your script using the PCNTL extension.

查看更多
登录 后发表回答