PHP display progress messages on the fly

Posted by XaviEsteve on Stack Overflow See other posts from Stack Overflow or by XaviEsteve
Published on 2010-06-09T20:26:01Z Indexed on 2010/06/10 13:53 UTC
Read the original article Hit count: 154

Filed under:
|
|

Hi everyone,

I am working in a tool in PHP that processes a lot of data and takes a while to finish. I would like to keep the user updated with what is going on and the current task processed.

What is in your opinion the best way to do it? I've got some ideas but can't decide for the most effective one:

  • The old way: execute a small part of the script and display a page to the user with a Meta Redirect or a JavaScript timer to send a request to continue the script (like /script.php?step=2).

  • Sending AJAX requests constantly to read a server file that PHP keeps updating through fwrite().

  • Same as above but PHP updates a field in the database instead of saving a file.

Does any of those sound good? Any ideas?

Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX