Possible Duplicate:
Sending large files reliably in PHP
I will be distributing a PHP script which enables people to provide downloadable products to their clients from their server via a masked URL (don’t want to give away the location on the server). Some files may be pretty large, so I need to make sure I use a method which is capable of handling larger files.
I am familiar with how to utilize each of the following download methods, I am just asking which would be the best to use (most efficient, reliable, universally supported, etc.):
Streaming fopen
Streaming cURL
file_get_contents
cURL
It’s generally best to let the webserver handle sending static files.
Use x-sendfile for apache, lighttpd or nginx. You can use php for auth, send the
X-Sendfileheader, the script will terminate, and the web server will handle the sending of the file. The end user will never know where the file is on the server.