[nycphp-talk] Asynchronous downloads -- how?

Kenneth Downs ken at
Wed Sep 5 15:59:38 EDT 2007

Dan Cech wrote:
> Kenneth Downs wrote:
>> Let's say you have a link on a page,
>>, which is actually being handled
>> by a PHP file that checks for subscription status and then sends the
>> file.  It looks like a straight download to the user.  So far so good.
>> Now let's say the file is 50MB, so that a download will take several
>> minutes.
>> When the user initiates the download, and then attempts to go to another
>> page on the site, they cannot.  All access to the site is waiting until
>> the download completes.
> This may be an over-simplification, but are you using
> session_write_close() after the authentication phase is complete?

Dan, I owe you a beer.  That was it.

> If the session is still active during the download, other requests with
> the same session id will hang while php waits for your download script
> to release the lock on the session file.
> Calling session_write_close() will end the session and relinquish the
> locks, allowing your other scripts to run.
> Dan
> _______________________________________________
> New York PHP Community Talk Mailing List
> NYPHPCon 2006 Presentations Online
> Show Your Participation in New York PHP

Kenneth Downs
Secure Data Software, Inc.
631-689-7200   Fax: 631-689-0527
cell: 631-379-0010

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the talk mailing list