Re: Delivering large files via PHP (>300MB)
| From: | Greg Donald | Date: | Mon, 13 Dec 2004 21:42:30 +0000 |
| Subject: | Re: Delivering large files via PHP (>300MB) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204229@lists.php.net to get a copy of this message | ||
On Mon, 13 Dec 2004 13:22:52 -0800 (GMT-08:00), Bruce Douglas
<bedouglas@earthlink.net> wrote:
> you might also look into 'bit torrent'...
You must have missed the part about 'cannot have this file in a
"public" location'.
> Just thought I would pick the collective brain on this one. I have
> a requirement to deliver a large EXE file to customers after they
> order. The file is just under 400 MB in size and, because they have
> just purchased it, I obviously cannot have this file in a "public"
> location on the web server that someone could browse to.
>
> I can push the file out quite easily using a modified header and a
> simple script to check if they can download it or not, but with
> such a large file a significant number of web browsers fail to
> obtain the entire EXE before closing - or any other number of
> factors kick into play (their PC resets, ISP disconnects, Windows
> crashes, etc).
Use set_time_limit(0); to prevent the timeout. ignore_user_abort() is
pretty handy too.
If that doesn't work you might give them authenticated http access
with temporary passwords. You can have the usernames and passwords in
a db and pass the proper auth headers with PHP.
> Some browsers support resuming download, but not when the file has
> been sent via the headers I use, also FTP is not an option as I
> cannot create and destroy FTP users on the server easily (or for
> that matter assume the customer knows how to perform FTP
> operations).
I feel your pain.
> I'm also aware that it's not such a hot idea to lock-up Apache for
> the time it takes to download the whole file, especially with a
> large number of users doing this.
Apache 2 is pretty good with multiple threads from what I hear. I use
it but not in a production environment.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/