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
?>
精彩评论