I used ZipArchive class to zip file before downloading.
On execution it gives following error:
Uncaught PHP Exception Symfony\\Component\\Debug\\Exception\\FatalErrorException: \\"Compile Error: require_once(): Failed opening required 'PHPEXCEL_ROOTPHPExcel/Shared/PCLZip/pclzip.lib.php' (include_path='/vendor/phing/phing/classes:/vendor/pdepend/pdepend/src/main/php:/vendor/phpmd/phpmd/src/main/php:.:/usr/share/pear:/usr/share/php')\\" at /vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/ZipArchive.php line 6"
php -m has both zip and zlib
Can anyone please help? Not sure why it is pointing to PHPExcel path as well.
Tried installing phpoffice/phpexcel using composer but it didn't help
$path = __DIR__.'abc.log';
$zip = new ZipArchive();
$zippath = __DIR__.'abc.zip';
if ($zip->open($zippath, ZipArchive::OVERWRITE) === TRUE)
{
// Add file to the zip file
$zip->addFile($path);
}
Expecting it to zip the file at a location
You are getting this error because PHP-ZIP extension is not installed in your server.
Follow below steps
I hope it will resolve your issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.