PHP provides the int fpassthru(resource $handle) function. You open a file, and then have fpassthru send the file outby simply copying it to the output without storing it, allowing potentially very large files to be sent.
<?php
// open the file in a binary mode
$name = './img/ok.png';
$fp = fopen($name, 'rb');
// send the right headers
header("Content-Type: image/png");
header("Content-Length: " . filesize($name));
// dump the picture and stop the script
fpassthru($fp);
exit;
If you can, it is better to avoid using PHP to do anything other than setting up the initial download, and then handing off the actual download to the webserver to control (and so release a PHP process). If you control the server, you can install/enable mod_xsendfile (for Apache) or the Nginx equivalent, X-accel.