ZipArchive Library Is Not Enabled When Using PHPExcel
Asked Answered
U

4

5

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
Unstable answered 16/4, 2013 at 17:35 Comment(0)
G
6

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

Gabble answered 16/4, 2013 at 22:23 Comment(1)
Sorry, where can I type this?Manichaeism
L
4

ZipArchive is a requirement for PHP Excel. You need to follow the install instructions for it to enable it on your production server.

It is already enabled on your development server, reason why it works there. Contact your host to see if it is already compiled, and if so how to enable it for your account.

Uncommenting the PECL extension from php.ini would enable it. Contact your host to have it enabled if you do not have access to the file.

Lamppost answered 16/4, 2013 at 17:51 Comment(3)
i dont have access to php.ini file, could you please tell me how to do it using .htaccessUnstable
Sorry, it's been awhile since I've not compiled PHP which doesn't require loading/unloading extensions. According to the PHP documentation the extension directive can only be modified via the php.ini file. You were once able to load extensions via the dl() function but support for it has been removed in PHP 5.3. So you need to contact your host and have them enable it for you.Lamppost
@user1888957 Did you get in touch with your host regarding enabling it on your account?Lamppost
M
1

Requirements

PHP version 5.2.0 or higher
PHP extension php_zip enabled *)
PHP extension php_xml enabled
PHP extension php_gd2 enabled (if not compiled in)
Mirabelle answered 12/8, 2013 at 6:34 Comment(0)
F
0

When upgrading to PHP 7, you should make sure to install the PHP 7 versions of you libraries as well. The PPA providing PHP 7 also provides a php7.0-zip package. You can install it with:

$ sudo apt-get install php7.0-zip

To see additional PHP 7 libraries that are available, run:

$ sudo apt-cache search php7.0-*

Fourdrinier answered 29/8, 2018 at 8:58 Comment(1)
Welcome to Stackoverflow. You are answering a 5 year old question. I doubt, that this will answer the original question, because php7 was not out at that time. Also, please indent commands and code with four spaces, so they will be shown with a typewriter font.Landers

© 2022 - 2024 — McMap. All rights reserved.