Uncategorized

Serving a large file through PHP without hitting memory_limit

Ran into a little problem hitting the memory limit for PHP when serving 100MB+ files through a script like:
$file = @fopen($filename,”r”);<br/><br />
if ($file)<br />
{<br />
while(!feof($file))<br />
{<br />
    print(fread($file, 1024*4));<br />
    [...]