Re: Emergency! Performance downloading big files
| From: | Michael Shadle | Date: | Tue, 01 Dec 2009 23:51:15 +0000 |
| Subject: | Re: Emergency! Performance downloading big files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300192@lists.php.net to get a copy of this message | ||
On Tue, Dec 1, 2009 at 3:21 PM, James McLean <james.mclean@gmail.com> wrote:
> The suggestion from other users of off-loading the PDF downloading to
> Apache (or another webserver) is a good idea also.
^
I never allow PHP to be [ab]used and kept open to spoonfeed clients
with fopen/readfile/etc.
in nginx:
header("X-Accel-Redirect: /uri/path/to/file")
in lighttpd (if I recall)
header("X-Sendfile: /full/path/to/file") or now header("X-Sendfile2:
/full/path/to/file byterange")
in apache there is a "mod_sendfile" module I think. never used it.
be sure to set appropriate other headers too. nginx will fill in the
content-length for you, but you need to fill in content-type i believe
still. things like that.