Trying to force-download file with PHP using usual:
header("Content-type: $type" );
header("Content-Disposition: attachment; filename=$name");
header('Content-Length: ' . filesize($path));
And it does successfully for files somewhere below 32 mb. For bigger ones it just returns zeroed file.
Obviously there's some kind of limit, but what sets it? Using Apache 2.2.11 and PHP 5.3.0.
I asked this question on stackoverflow but they said that it better fits here. I'm not personally sure since I do not know what causes it in first place. Maybe it's Apache?
readfile()
buffers the entire file in memory before streaming it back to the client. In yourphp.ini
you've probably gotmemory_limit=32M
Either raise that, or spool the file in smaller chunks