Forum Moderators: coopster

Message Too Old, No Replies

why can't I load the same php file in two browser windows

at the same time

         

pixeltierra

6:19 am on Sep 10, 2008 (gmt 0)

10+ Year Member



I have file.php that takes 5 minutes to complete - using sleep().

I load file.php in one browser tab, and get output every 2 seconds.

If I load the same file.php in another tab while the first one is still going, it just spins doing nothing until the first tab is fully done.

What controls this behavior, the browser, or the server (mine=apache)? How can I get the server to run both tabs at the same time.

In this case the file in question needs to be a force-download script so that a user can download multiple files at a time.

All input appreciated...

pixeltierra

3:27 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Surely someone has some info here....

pixeltierra

6:13 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Well after much browbeating, I have some answers for anyone who stumbles upon this thread in the future:

My tests have shown that apache will not load the same file at the same time if they have the same name unless they are followed by different query strings.

Even more importantly (and this is probably your case) if you are using

file.php?id=1 and
file.php?id=2

These will not load simultaneously if you are using sessions. You must close the session for writing (session_write_close) before the other file will load.

Took me a week to work this out. I hope this helps someone.