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 (p
If your OS supports it, you can use the pcntl_fork() function to spin off child processes that the parent doesn't wait for. Be careful though, it is easy to accidentally create too many child processes, especially if they take longer than expected to run!
use php's version of fork or threads.
You could run them in the background:
system('php yourscript.php &');
You just have to make sure that you check on the total number of processes running. All in all, not a super elegant solution. Instead cron you could let one script run for forever, I am thinking something like this:
<?php
while(true) {
// do whatever needs to be done.
}
?>
Careful though. PHP is not exactly known to be used as a daemon.
http://php.net/pcntl_fork
It's *NIX only but you can fork your script using the PCNTL extension.
I think the answer would be very similar to those already provided for Asynchronous PHP calls.
I'm not sure that PHP supports threading. Check here.