A "headers already sent" warning arises .I close $zip->close();
but still show warning
$zip = new ZipArchive;
$download = 'new_zip.zip';
$zip->open($download, ZipArchive::CREATE);
foreach (glob("zipfile/*") as $file) {
$zip->addFile($file);
}
$zip->close();
header('Content-Type: application/zip');
header("Content-Disposition: attachment; filename = $download");
header('Content-Length: ' . filesize($download));
header("Location: $download");