Updating a progress bar during php scripts oasis dating club
This solution seems like it would solve all of our problems. We can just send packets along to update the client whenever we want, but, there’s a big problem – on shared hosting environments, this can be very hard, if not impossible, to accomplish.Web sockets allow bi-directional communication between the server and the browser, keeping a pipeline between the two open for communication. Not only are web sockets hard to realise on shared servers, but they consume a lot of memory and processing power as they tend to run constantly in the background.The drawback with this technique is that not all browsers are able to handle the ready State==3.A lot of browsers like IE 8-9 go from ready State==2 directly to ready State==4.If you are doing multiple files or multiple things in the task, you may also want to handle that logic in this step Do the job & Return the progress.Once you have figured out how transactions occur you can then use any server side push technology to send update packet.When process is divided into steps you can resume a failed task from the point where it succeeded last. But the overall process flow looks like this The following method is what I did for a personal project and this script held good for uploading and processing thousands of high resolution image to my server which then were scaled down into multiple versions and uploaded to amazon s3 while recognizing objects inside them.
This is something that can be changed, but not easily, and certainly not easily on shared hosting environments.
However the PHP script still runs and the user will have at least some sort of feedback once the script completes.
XHR DEMO This technique is a little older and not really elegant but works even in IE 8.
How can I update a progress bar (html), during a long loop (php -- database export/import mysqli) I don't want to use a file or database for storing temporary values or progression of the loop as that causes too many IO's to be used (and in the case of file based solution, the client ends up often reading the file before the data has been written) I was considering some event type situation however output buffering takes too long to update the display.