Re: Timeout while waiting for a server->client transfer to start (large files)
| From: | Per Jessen | Date: | Thu, 31 Jan 2008 07:13:55 +0000 |
| Subject: | Re: Timeout while waiting for a server->client transfer to start (large files) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268415@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
> Your script is reading the whole file, 64 measly bytes at a time, into
> a monstrous string $tmp.
>
> Then, finally, when you've loaded the whole [bleep] file into RAM in
> $tmp, you just echo it out, right?
>
> Don't do that.
>
> :-)
>
> while (!feof($fp)){
> echo fread($fp, 2048);
> }
And if the OP is opening the file anyway, he might as well use
readfile() instead.
/Per Jessen, Zürich