Jump to content

casualcoder

New Members
  • Posts

    2
  • Joined

  • Last visited

casualcoder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for your reply. $filelocation refers to a local file hosted under the public_html directory in several subfolders. The script fails by randomly terminating before it completes. For example, a 300mb file may terminate anywhere between, say, 25mb downloaded or 200mb downloaded as a general rule. There are no error messages during execution of the script or upon termination. It just looks to the end user like the file downloaded fully and successfuly. I tried changing the set_time_limit() option before (it was one of the early suggestions made by my host) however it made no difference.
  2. I've been having trouble with one of my download scripts i've been using for a while which prevents users from seeing the direct-link location of a file. It's a simple php script which has worked on and off on several servers in the past. I used to think that it "stopped" working because of an issue with my hosting account but now it's happening too often that I have to consider the script is doing something wrong and clogging something up on the server. So, first the script itself (relevent parts only, disregard syntax or undefined variables, assume its all there): <?PHP $file_name = "download.zip"; $filelocation = "$rowx[FILE_URL]"; //fetches the file url from mysql database. header("Content-type: application/octet-stream\n"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0\n"); header("Content-Transfer-Encoding: binary\n"); header("Content-disposition: attachment; filename=\"$file_name\"\n"); readfile("$filelocation"); ?> Simple, right? One thing the script never does is actually find the filesize and allow for a perctage download indicator. The download is always for an "unknown" size. This could be part of the problem. Also, I checked to make sure there was no mysql database issue (being open too long or whatnot) so i closed the connection at the end of the script. Problem persists. My host advised me to increase the memory limits and cache in the php.ini file. It did absolutely nothing. Recently, when the problem came back on a new server. The host told me to upgrade to a dedicated IP, which I went ahead and did.The problem DID go away around this time, but I can't attribute it to the dedicated IP because they (the host) were likley mucking around the server around the same time and could have been flushing cache's and any number of things so I can't say what fixed it temporarily. My suspicion is still that something in the script is causing a table on the server to fill up and perhaps its not being dumped as new data is being written, hence the terminated download. That's only a guess, however. I've been having this problem on and off for YEARS, so a big thanks in advance to anyone who can help even a little.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.