title: PHP script to run in background with visible progress
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7049303/show-progress-for-php-long-script">Show progress for PHP long script</a>  </p>
  </blockquote>
  
  
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>I think I can do it this way, but is there any standard way that I maybe don't know of?</p>