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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:20:28+00:00 2026-06-09T01:20:28+00:00

Possible Duplicate: Show progress for PHP long script I have a PHP script that

  • 0

Possible Duplicate:
Show progress for PHP long script

I have a PHP script that generates large PDF document on request. This usually takes about 1-2 minutes, and the only way it lets the user know that it is finished is by sending an email when it the whole process completes.

I would like to have some kind of a progress bar displayed to the user while the file is generated. What is the best way to approach this task? The only thing that comes to my mind is that the PDF-generating script should save data in the database (I already use MySQL in the project), and on the client-side I could include Ajax request that would poll for this progress data say every 5 seconds and display it to the user. So probably there would be two Ajax requests: one to launch the PDF-generating script and another one for the user to see the progress.

I think I can do it this way, but is there any standard way that I maybe don’t know of?

  • 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-06-09T01:20:30+00:00Added an answer on June 9, 2026 at 1:20 am

    Your proposed approach:

    …is probably the easiest and it also walks on known grounds so it’s something you’ll handle and debug easily.

    To it i can only add that you could use a fork/exec/passthrough instead of the ajax call that initiates the PDF generation.

    A more elegant (to be read: complicated) approach:

    PHP Gearman is a stand alone server you can run on the machine which has a PHP communication library.

    You can have the Gearman daemon running, give it a task to work on and write data to the database for the progress bar. The advantage of this setup is that fork/exec/passthrough are expensive operations – Gearman being a daemon is already on so it handles the exec call to the PHP worker and your triggering script will need to work for a shorter time.

    I’m not sure if it has a communication API to ask the Gearman about the state of a certain worker and thus avoid adding a database to the cocktail.

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

Sidebar

Related Questions

Possible Duplicate: Android: ProgressDialog.show() crashes with getApplicationContext I want to have a progress dialog
Possible Duplicate: Hide/Show Navigation & Tool Bar on tap This is the void I'm
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Why is this function returning “undefined”? Let's assume I have the following
Possible Duplicate: Show the original branch for a commit git version 1.7.4.1 I have
Possible Duplicate: How to show/hide a div on mouseover using jquery? I have a
Possible Duplicate: how-to-align-a-div-to-the-middle-of-the-page I need to show this Div tag allways center of the
Possible Duplicate: How to display progress dialog before starting an activity in Android? this
Possible Duplicate: How do I show the changes which have been staged? Is there
Possible Duplicate: Quitting an application - is that frowned upon? I have written a

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.