title: Large zip files served appear on client as 0 byte files
body: <p>I am serving up files via php through apache.  I'm having a problem where relatively large files (I'm working on a 350 MB zip) appear to be downloading all the way but on the client they appearing as a zero byte file.</p>
  
  <p>Only one file is being served at a time and the only files served are zip files.  I'm having no problem with smaller files. (eg 70MB).  I've bumped up the time and memory limits to seemingly overly generous values (both in the php and the php.ini).  After about 20-30 seconds it appears to be done downloading, but in both Firefox and Chrome, there's no good result:</p>
  
  <p>Firefox: no error message.  Dialog pops up to save or Open.  It saves as a zero byte file.  If told to open, winzip provides an error message that the file is broken.
  Chrome: After about 20 seconds, it says "This webpage is not available" and shows .  It also says "Error code: ERR_CONTENT_LENGTH_MISMATCH"</p>
  
  <p>I don't know if this means anything, but I've looks at the network activity in Chrome's dev tools and the 70MB file's shows as (cancelled) under Status after its been served correctly.</p>
  
  <p>Here's the php code:</p>
  
  <pre><code>ini_set('memory_limit', '500M');  //also see memory_limit in php.ini
  set_time_limit(60);  //also max_execution_time in php.ini
  header('Content-Description: File Transfer');
  header('Content-Type: application/octet-stream'); //also tried application/zip
  header('Content-Disposition: inline; filename='.basename($fileLocation));
  header('Content-Transfer-Encoding: binary');
  header('Expires: 0');
  header('Cache-Control: must-revalidate');
  header('Pragma: public');
  header('Content-Length: ' . filesize($fileLocation));
  ob_clean();
  flush();
  readfile($fileLocation);
  exit;
  </code></pre>
  
  <p>Thank you!</p>