Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You might want to look at <a href="http://php.net/pcntl_fork" rel="nofollow noreferrer"><code>pcntl_fork()</code></a> -- it allows you to fork your current script and run it in a separate thread.</p> <p>I used it in a project where a user uploaded a file and then the script performed various operations on it, including communicating with a third-party server, which could take a long time. After the initial upload, the script forked and displayed the next page to the user, and the parent killed itself off. The child then continued executing, and was queried by the returned page for its status using AJAX. it made the application much more responsive, and the user got feedback as to the status while it was executing.</p> <p>This link has more on how to use it:</p> <ul> <li><a href="https://sites.google.com/a/van-steenbeek.net/archive/php_pcntl_fork" rel="nofollow noreferrer">Thorough look at PHP's pcntl_fork() (Apr 2007; by Frans-Jan van Steenbeek)</a></li> </ul> <p>If you can't use <code>pcntl_fork</code>, you can always fall back to returning a page quickly that fires an AJAX request to execute more items from a queue.</p> <hr> <blockquote> <p><em><a href="https://stackoverflow.com/users/371793/mvds">mvds</a> reminds the following (which can apply in a specific server configuration):</em> Don't <code>fork</code> the entire apache webserver, but start a separate process instead. Let that process fork off a child which lives on. Look for <a href="http://php.net/proc_open" rel="nofollow noreferrer"><code>proc_open</code></a> to get full fd interaction between your php script and the process.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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