This may have several reasons.
You say server resources are fine, but I think PHPs readfile()
loads the entire file into memory before sending it. Fortunately, there is a good solution in the documents that you should definitely use to prevent problems with multiple downloads :)
Also, have you set the script execution time to infinite?
Next will be the settings of your server. Perhaps they close the connection for some timeout / resource reason.
Use the Google Chromes Developer Tool to carefully review the headers you sent. PHP sets some headers on its own. You should put session_cache_limiter(false);
to the beginning of your script. If I remember correctly, even Expires: Thu, 19 Nov 1981 08:52:00 GMT
... Why is this bad? Next up;)
You can send Etag and Last-Modified header. I summarize this unique identifier for your resource, which allows you to resume downloading. I think finding good articles about this is better than just giving you some suggestions. In your case, you can use PHPs stat()
to create Etag.
There are some people struggling with headers and downloads, you can start (or fix your case) here
Summary:
- Check PHP expiration settings / server / limits / resources
- Be sure to send the buffered file
- Let me resume downloading
- Check sent headers.
After that you should be fine. With renewal, even if it breaks anyway ...
Good progress and success!
source share