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 7592525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:55:43+00:00 2026-05-30T20:55:43+00:00

I have a script that takes an uploaded text file, parses it and then

  • 0

I have a script that takes an uploaded text file, parses it and then inserts quite a bit of rows into a database. This process takes about a minute.

Even though I am using AJAX I don’t want my users to have to see Loading… for upwards of a minute while the database is being populated. Actually, as soon as the parsing completes successfully, the database INSERTS will always work because everything is validated during parsing.

So what I need to do is return a JSON string {success:true,data:{cartons: 1000, batchname:"Batch1"}} as soon as the parsing is successful. I do this, but the browser doesn’t parse the response until the connection is closed (script is through running) Is there anyway to get the browser to accept the response as it comes in or for me to close the connection with the browser while my PHP script continues to run?

I am using ExtJS as the Javascript framework that is handling the AJAX. Any ideas? This has been racking my brain for about a week.

  • 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-30T20:55:44+00:00Added an answer on May 30, 2026 at 8:55 pm

    Just specify the length of the body content of the response:

      $out = 'Return this';
      header("Content-Length: " . strlen($out));
      header("Connection: close");
      echo $out;
      flush();
      echo 'But do not return this';
      // create some file to show that script continues its execution 
      file_put_contents('script.is.running', '');
    

    Also you can run other scripts from command line in the background (without waiting for their completion) or perform a http request to the script with ignore_user_abort function in it.

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

Sidebar

Related Questions

I have a script that takes a table name and generates a control file
I have a Perl script that takes text values from a MySQL table and
I have a nant script that ... 1. takes the content of disc-file 2.
I have a script that takes a number of filenames, and then serializes the
I have a python script that takes a movie file name and it does
I have a php script that takes the individual characters entered into a form
I have bash script that takes in a couple of arguments tests then and
I have small script that takes the value from a text input and needs
I have written a pretty basic upload script that takes the file and uploads
I have a script that takes a command and executes it on a remote

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.