views:

66

answers:

1

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.

+1  A: 

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.

Artefacto
Is there a way to use this with setting the header("Location")? It looks like whoever built this redirects the user to a new page when the process finishes using the header()
Rachel
I ended up replacing the redirect links with javascript. I figured this app is only used by a handful of users and all of the validation is done in javascript anyways (I didn't build this thing) so if someone has js disabled they'll notice problems before this.
Rachel