Hello all,
I’ll try to make this as short as I can.
First off, I don’t know much about PHP so I purchased a couple of scripts online and I’ve been working with the author to try and find a solution to a problem I uncovered but we can’t seem to find the cause or solution to the problem.
These scripts have the same general purpose. They create long URL’s to hide the true location of files that can be downloaded. Script A works fine. It basically uses sessions to create links to files so any user can download a file but still not know the true location of the file. Script B does the same thing but it uses cookies in addition to sessions and it also secures the page so only users of specific groups can access the page and the script generated links will only work for the specified group or specified user.
The problem is that script B causes time outs and only one file can be downloaded at a time. Here’s how to reproduce the timeout:
Say I have multiple links on a script B secured page and the user clicks on all of the links to start the download of all files at the same time. What happens is the first download starts and completes but the user’s browser window goes blank and a PHP timeout error is returned and none of the other files start to download. Basically, the script will not allow multiple downloads to take place, at the same time, and if the first download is large enough, it causes the time out. If the files are really small, the timeout does not happen but the first download must complete before the second download starts and so on and so on.
This does not happen with script A. The user can click on as many script A generated links as they want and all downloads start within seconds of each other and complete with no time outs no matter how large the files are and no matter how long it takes to download them.
I hold the author of the scripts in very high regard. Both scripts use a lot of the same code and he seems to think the issue is internal to PHP since he can find no difference in the way both scripts handle downloads.
I realize no one could possibly pinpoint the cause of this issue based on my description, but does anyone know if there is something internal to PHP that would cause one script to allow multiple downloads while the other only allows sequential downloads? Could it be related to cookies? My guess is that script B is still running in the background (for whatever reason) until the last download is completed.
Thanks for taking the time to read my post 🙂