0

I am using PHPExcel PHP library for reading xlsx files and every thing is fine. when I am deploying my web application in our server I am facing the below error:

Fatal error: Uncaught exception 'Exception' with message 'ZipArchive library is not enabled'

I know that ZipArchive is a requirement for PHP Excel. and I need to follow the install instructions for it to enable it on my production server.

This error because PHPExcel require the below requirements:

  1. PHP version 5.2.0 or higher
  2. PHP extension php_zip enabled
  3. PHP extension php_xml enabled
  4. PHP extension php_gd2 enabled

Now I cant access our nginx server and cant compile "PHP extension php_zip" then enable it.

my question is:

Is that any Alternatives for PHP_excel dose not require ZipArchive class with PHP extension php_zip enabled ?

I am trying these Alternatives for PHP_excel but all of them based on zip.so compiled and php_zip extension enabled.

Any help will be more than appreciated.

Community
  • 1
  • 1
HMagdy
  • 3,029
  • 33
  • 54

1 Answers1

4

Since version 1.8.0, PHPExcel has offered an alternative built-in Zip handler that can be enabled by setting

PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

before loading any files that are zip-based archives such as xlsx or ods

This is slower and uses more memory than PHP's own ZipArchive extension, but provides an alternative if ZipArchive isn't enabled

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • thanks for reply but , using this option dose not mean no PHP extension php_zip required it's another option based on same extension you can test PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP); die(var_dump(PHPExcel_Settings::getZipClass())); return PHPExcel_Shared_ZipArchive .. also based on that extension any ideas – HMagdy May 13 '14 at 10:02
  • 1
    The PCLZIP code is __not__ based on the ZipArchive extension in any way; it replicates the core functionality of ZipArchive with its own pure PHP code... ZipArchive is __not__ required to use the PCLZip option, otherwise there would be no point in even having the PCLZip option – Mark Baker May 13 '14 at 10:09
  • YA really thank you so so much you are totally right the above comment was on older version not the one you suggest thank a lot (y) – HMagdy May 13 '14 at 10:37
  • for ubuntu 14.04 and php5.5, apt-get install php5.5-zip php5.5-xml – cwhsu Jul 12 '16 at 03:01