Re: [PHP Header] Right-Click Download in Firefox showing php filename
| From: | mike | Date: | Mon, 04 Aug 2008 07:26:03 +0000 |
| Subject: | Re: [PHP Header] Right-Click Download in Firefox showing php filename | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277660@lists.php.net to get a copy of this message | ||
On 8/3/08, Will <wilzdezign@gmail.com> wrote:
> @readfile($filename);
You should look into a webserver and instead of using readfile() which
will keep the PHP engine open while it is spoonfeeding the browser,
offload the file to the webserver.
nginx has X-Accel-Redirect (nginx is the best anyway)
Lighttpd has X-Lighttpd-Sendfile (or something)
Apache has mod_sendfile (something like that)
etc.
I don't think it will change the renaming behavior, but it will
offload your PHP engines for normal processing. :)
Basically (you'll have to configure it quick but otherwise) instead of
the readfile($file) you'd be sending another:
header("X-Accel-Redirect: $file"); (you have to configure $file's location)
and that's it. the webserver takes over and PHP is released back to do
other things.