Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent browser timeout in long-running processes?

How would you prevent a browser from timing out while a long process is running in php?

We have a process which accepts a file upload and runs process on the file data. Sometimes this file can be very large with a lot of records, and in these cases the user gets a timeout error. I believe it is a browser timeout because the script is still running in the background and finishes successfully.

I normally don't work in php (in fact, never before troubleshooting this website) and was wondering if there was an easy way to prevent the browser from timing out while the process runs.

like image 219
Rachel Avatar asked Aug 23 '10 15:08

Rachel


People also ask

How do I stop my browser from timing out?

Check your firewall and internet security to make sure your browser is not blocked from accessing the internet. If you have any website filtering software installed in your system, then uninstall them. Once you apply these changes in the firewall, there will be no timeout error in Google Chrome.

Why does my browser timeout?

The timed-out error is usually due to no communication between your browser and the website you are trying to access. This is because either your browser cannot receive the data or the time it took crossed the timeout session and couldn't establish a connection.


1 Answers

Most browsers will not timeout once they start receiving data.

SO all all you have to do is to echo some part of the page in the beginning, flush it, and then proceed to your long running job.

like image 53
Artefacto Avatar answered Sep 20 '22 00:09

Artefacto