开发者

concurrency and PHP scripts

I'm trying to fire a php script inside another php script. This is easy, the problem is that the first script can not wait for the second to finish. I want a fire and go mechanism.

Any help would be appreciated,

Than开发者_如何学JAVAks in advance.


From exec documentation:

If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.

That is, the following should work:

exec("php /path.to.file.php > /dev/null");


You would have to use exec()

On your server / Operating system add the php/bin directory to your environment variables and then execute the command like so:

<?php
    //Blah

    exec("php /path.to.file.php /dev/null");

    //Blah
?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜