[thelist] Downloading a Compiled CSV File without timing out

Rob robbiesmith79 at gmail.com
Thu Oct 29 14:37:26 CDT 2009

Hi List,

Long time no see, must be at least 4 years since I've helped out here.

I have a unique situation where I seek your expertise. My hosting company
uses a controller that monitors all php activity. If a script seems to be
running for more than 30 - 60 seconds it'll will kill the script.

The situation is this. The client needs to be able to download a csv version
of the database sometimes with a filter applied. At first it was fine
because there wasn't that much data, now the same script is taking this long
because of having to compile the csv file, hense timing out.

Some suggestions offered already:

Use the flush route
Pros: it works but the output is displayed on the browser
Cons: it needs to be a csv file. I suggested that I just spit it out in a
table and since they're in IE anyway, just right-click the grid and export
to excel. Not gonna fly.

Use exec() to call the csv build file and use Ajax to poll if done
Pros: Sounds cool. bit beyond my expertise
Cons: The query that gets the data can be customized by a filter who's
variables are stored in a $_SESSION array. Not sure if the session would
survive an exec call.


Robbie Smith
Freelance Web Developer

More information about the thelist mailing list