Rachel
Rachel

Reputation: 132548

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.

Upvotes: 8

Views: 7335

Answers (1)

Artefacto
Artefacto

Reputation: 97805

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.

Upvotes: 5

Related Questions