Can't load multiple PHP pages at once

#1
I have a site that is supposed to serve files via a PHP page. If this PHP page is serving a file (ie. a 20MB file), nothing else will load at the same time. It waits for the current file to finish loading before loading the next one (and also means the site doesn't work in another tab). Is there some way to fix this? Thank you.
 
#3
how about open 2nd file in another browser ? can download 2 files at the same time ?
While downloading the file served by PHP in Chrome I cannot access any pages on the site in Chrome, but, while downloading a PHP-served file in Chrome I can access the site from Internet Explorer. Visa-versa for Internet Explorer.

I also have a friend that confirms the issue
 

NiteWave

Administrator
#5
it's PHP script which limit the downloads.

looks like the PHP script use the session cookie to archive this goal.

in firefox, open a tab, can access a URL to download a 50M file,
when open 2nd tab, access same URL, it'll wait until 50M file download completed.
if open the URL in another browser, it starts downloading without wait.

then back to firefox, open firebug+firecookie, delete all cookies, then can open 2nd tab to download same file at the same time.

so it's not relating to web server, but PHP script do it purposely.
 
#6
it's PHP script which limit the downloads.

looks like the PHP script use the session cookie to archive this goal.

in firefox, open a tab, can access a URL to download a 50M file,
when open 2nd tab, access same URL, it'll wait until 50M file download completed.
if open the URL in another browser, it starts downloading without wait.

then back to firefox, open firebug+firecookie, delete all cookies, then can open 2nd tab to download same file at the same time.

so it's not relating to web server, but PHP script do it purposely.
Thanks for your help. It seems I can get around this by using the information on this page: http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed:wiki:feature:internal_redirect

I am a bit unclear as to how to use this header. In the PHP file that processes/handles the download, should I simply replace all of my current headers to force the download and just use header("X-LiteSpeed-Location: /path/to/my/file");

Thanks
 

NiteWave

Administrator
#11
if the image's suffic is jpg/png etc, I think still ok to use X-LiteSpeed-Location

the X-LiteSpeed-Location is like redirect (but internal not external), pass this file to web server(here litespeed) to handle it. so if the file name is .jpg, web server will think it a jpeg image and generate proper headers for it.
 
#12
if the image's suffic is jpg/png etc, I think still ok to use X-LiteSpeed-Location

the X-LiteSpeed-Location is like redirect (but internal not external), pass this file to web server(here litespeed) to handle it. so if the file name is .jpg, web server will think it a jpeg image and generate proper headers for it.
Unfortunately my site doesn't retain the extension of the file on the disk (but does in the database) - is there any way to trick LiteSpeed into thinking it's a .jpg?
 

NiteWave

Administrator
#13
I have an idea in your php script, create a temporary symbolic link to the file, like a.jpg, then "X-LiteSpeed-Location: /path/to/a.jpg". when download complete, delete a.jpg. or create a cron job, clean up these temporary soft link(a.jpg) which created 1 hours ago(for example).
 
#14
I have an idea in your php script, create a temporary symbolic link to the file, like a.jpg, then "X-LiteSpeed-Location: /path/to/a.jpg". when download complete, delete a.jpg. or create a cron job, clean up these temporary soft link(a.jpg) which created 1 hours ago(for example).
Thanks, I'll give it a shot. Can I remove the symlink after the X-LiteSpeed-Location header? ie.

header('X-LiteSpeed-Location: /files/tmp/temp.png');
unlink('/files/tmp/temp.png');

When using them in that order I receive the following error in LiteSpeed:

detect loop redirection
 
Last edited:

NiteWave

Administrator
#15
Can I remove the symlink after the X-LiteSpeed-Location header? ie.

header('X-LiteSpeed-Location: /files/tmp/temp.png');
unlink('/files/tmp/temp.png');
No, can't.

since the temp.png not sent to user yet.
the 1st line is to tell litespeed web server, "please send this file to user"

maybe you have to
create a cron job, clean up these temporary soft link(a.jpg) which created 1 hours ago(for example).
 
#16
No, can't.

since the temp.png not sent to user yet.
the 1st line is to tell litespeed web server, "please send this file to user"

maybe you have to
Thanks, I've got an idea for that now.

I am using the symlink option to send files to the user via X-LiteSpeed-Location (with the extension), but it seems that extension was not sent with it.
 

webizen

Well-Known Member
#17
...
I am using the symlink option to send files to the user via X-LiteSpeed-Location (with the extension), but it seems that extension was not sent with it.
make sure you can serve image file with extension directly (i.e., MIME type is supported) before serve via X-LiteSpeed-Location.
 
Top