Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your plan should work, but I think you could avoid all the database communication and even polling by using the <a href="http://www.php.net/manual/en/book.pcntl.php" rel="nofollow">PHP Process Control functions</a>.</p> <ol> <li>Fork your main process as many times as tasks you need it to run in parallel. See: <a href="http://www.php.net/manual/en/function.pcntl-fork.php" rel="nofollow">pcntl_fork</a></li> <li>Perform your tasks in those forked processes and let them exit normally.</li> <li>The process that initiates the tasks should wait for them to all complete by listening for their SIGCHLD signals as they exit. Or if they don't before your chosen timeout, then send the SIGTERM signal to them to clean up. See: <a href="http://www.php.net/manual/en/function.pcntl-sigtimedwait.php" rel="nofollow">pcntl_sigtimedwait</a> and <a href="http://www.php.net/manual/en/function.posix-kill.php" rel="nofollow">posix_kill</a>.</li> </ol> <p>You will have to use these functions in a PHP CLI script, though, because...</p> <p><a href="http://www.php.net/manual/en/intro.pcntl.php" rel="nofollow">http://www.php.net/manual/en/intro.pcntl.php</a></p> <blockquote> <p>Process Control should not be enabled within a web server environment and unexpected results may happen if any Process Control functions are used within a web server environment.</p> </blockquote> <p>But your web server could easily <code>exec()</code> your CLI script, which will do all the hard work, return the status of those tasks, etc.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload