The following zip program works without any issues for smaller size files approximately few hundred MB. But when the .zip archives are bigger, the program showing zip archive extraction failed. I have increased mem size and exec time. My file zip size is 2.30GB. My code is:
ini_set('max_execution_time', 0);
ini_set('memory_limit', '30000M');
function unzip_file($file, $destination)
{
// create object
$zip = new ZipArchive() ;
// open archive
if ($zip->open($file) !== true) {
return false;
}
// extract contents to destination directory
$zip->extractTo($destination);
// close archive
$zip->close();
return true;
}
if (unzip_file($_SERVER["DOCUMENT_ROOT"].'/testarul/www.zip', $_SERVER["DOCUMENT_ROOT"].'/testarul/')) {
echo 'zip archive extracted successfully';
} else {
echo 'zip archive extraction failed';
}