note 99286 deleted from function.session-start by peehaa
| From: | peehaa@php.net | Date: | Fri, 09 Dec 2016 22:25:08 +0000 |
| Subject: | note 99286 deleted from function.session-start by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208358@lists.php.net to get a copy of this message | ||
Note Submitter: user at annon dot org
----
I recently stumbled upon a problem in my download script where a download link would be clicked but
then no other links would work until that download had finished. Other instances/windows would not
work either.
This is because session_start() locks the session data until the script finishes. In my case, until
the script had finished sending the file data (which in a throttling script can take a while).
The solution is to use session_write_close();
This writes the current session data back to the session and closes the session so that other
instances/windows can access the script using the same session.
Since adding it to my script my site can now have several files downloading at once from the same
session and still serve pages.