PHP or HTTPD configuration issue

There is some weird problem with server configuration, it outputs corrupt data from PHP.

Simple PHP script:


$file = '../downloads/';

$size = filesize($file);
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $size);



File is 25 Mb long, that script should just send it to browser. For some reason it only sends small chunk of file (each time different amount, from 4Kb to couple Mb) and then aborts. There is no time out, abort happens few seconds after script execution.

Any ideas what in server configuration could cause this to happen?

How are your php and web server set up? Which server are you using?

It not mine, problem is happening on website of one of my clients. Here is phpinfo:

Maybe you’re running in to the memory limit somehow? Have you tried a smaller file, like say 1MB ?

Check the Apache Error Log, that’d normally give you a reason for any error that did occur, equally, the error MIGHT be appended to the end of the .zip file (open it in a basic text editor).

I’ve tried sending that file in 1Mb chunks instead of readfile(), which reads whole file into memory. It does help a bit, download is much faster and usually half of file is being sent before abort instead of few kilobytes.

So its a memory issue then?

Unfortunately I don’t have access to logs. Checked end of zip file, nothing there.

Actually, I do have access to error.log! I was wrong.

Here is error from log:

[Sun Nov 13 17:26:21 2011] [warn] ID: 12 File: /home/embroide/public_html/_test.php Rate : 10000000 Minimum : 256 Size rate : 10000000 IP: hostname: