ZipArchive Library Is Not Enabled When Using PHPExcel

adib.mosharrof picture adib.mosharrof · Apr 16, 2013 · Viewed 18.8k times · Source

I am using CodeIgniter and PHPExcel to read and write to excel files.

Everything worked fine in localhost, but when I uploaded my PHP CodeIgniter application to the server in pagodabox I got the below message when I tried to read data from excel files.

Fatal error: Uncaught exception 'Exception' with message 'ZipArchive library is not enabled' in /var/www/application/libraries/PHPExcel/Reader/Excel2007.php

Answer

Mark Baker picture Mark Baker · Apr 17, 2013

For writing, PHPExcel does provide PCLZip as an alternative to ZipArchive. You can configure it to use this by calling

PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

But if you want to read any of the zipped spreadsheet file formats (e.g. xlsx, ods) then you do need PHP's zip archive extension enabled

EDIT

With effect from version 1.8.0, the PCLZIP option is now available when reading zipped formats as well as for writing them