I'am using ZipArchive class to generate and download zipFile. It must be work on php 5.2.14. It works perfectly on php 5.3.x with this code:
$filename = "test.zip";
$zip = new ZipArchive();
$opened = $zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
$zip->addFromString(...,...);
$zip->close();
header('Content-disposition: attachment; filename='.$filename);
header('Content-type: application/zip');
readfile("$filename");
exit();
On php 5.2.14 it produces an empty (0 byte size) zip file. If I remove the exit() instruction it produces a corrupted zip file.
Solutions?