Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3665564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:46:34+00:00 2026-05-19T01:46:34+00:00

I have a web app that has a few processes that can take up

  • 0

I have a web app that has a few processes that can take up to 10 minutes to run. Sometimes these processes are triggered by a user and they need the output as it is processed.

For instance, the user is looking for
a few records that they need. The
click the button to retrieve the
records (this is the part that can
take 10 minutes). They can continue
to work on other things but when they
click back to view the returns, it is
updated as the records are downloaded
into the system.

Right now, the user is locked while the process runs. I know about pcntl_fork() to fork a child process so that the user doesn’t have to wait until the long process completes.

I was wondering if it’s possible to tie that forked process to the specific user that triggered the request in a $_SESSION variable so that I can update the user when the process is complete. Also, is this the best way to update a user on a long-running process?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:46:35+00:00Added an answer on May 19, 2026 at 1:46 am

    I think gearman fits your needs. Look at this sample code, taken from the doc :

    <?php
    
    /* create our object */
    $gmclient= new GearmanClient();
    
    /* add the default server */
    $gmclient->addServer();
    
    /* run reverse client */
    $job_handle = $gmclient->doBackground("reverse", "this is a test");
    
    if ($gmclient->returnCode() != GEARMAN_SUCCESS)
    {
      echo "bad return code\n";
      exit;
    }
    
    $done = false;
    do
    {
       sleep(3);
       $stat = $gmclient->jobStatus($job_handle);
       if (!$stat[0]) // the job is known so it is not done
          $done = true;
       echo "Running: " . ($stat[1] ? "true" : "false") . ", numerator: " . $stat[2] . ", denomintor: " . $stat[3] . "\n";
    }
    while(!$done);
    
    echo "done!\n";
    
    ?>
    

    If you store the $job_handle in the session, you can adapt the sample to make a control script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a web app that has to save a few files. I
I have a web app that has a big and complex form (fields, checks,
I have an existing web app that has a data layer and a bll
I have C# MVC web app that has some textboxes that in IE9 you
I have a very simple Mac Cocoa app that just has a Web View
I have a web app, that also has an iPhone and Android app using
I'm currently building a web-app that has one section where the user sees a
A complex web-app can have a large amount of user and/or context specific meta
I have a web service app that has an xml file with Oracle connection
I have a Django webapp that has both a front-end, web-accessible component and an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.