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