NYCPHP Meetup

NYPHP.org

[nycphp-talk] Writing large files to client efficiently

John Campbell jcampbell1 at gmail.com
Thu Jan 10 14:55:43 EST 2008


On Jan 10, 2008 1:49 PM, Michael B Allen <ioplex at gmail.com> wrote:
> What is the most efficient way to write large files to the client?
>
> fpassthru?
>
> Mike

Yes.  Make sure you are not output buffering, and don't forget to call
session_write_close() before running fpassthru() if you are using
php's default session handler.

I have done this with fpassthru, and i have also used 302 redirects to
hashed file names.  The latter isn't as secure but it is more flexible
and faster.  Just as a heads up, fpassthru is going to be a problem if
you have mutiple servers.

Regards,
John Campbell



More information about the talk mailing list