Fatalerror: Class 'ziparchive 'notfound solution

Source: Internet
Author: User
Tags ziparchive zts
When uploading an Excel file and displaying the output file under Linux today, the ZipArchivelibraryisnotenabled exception is thrown. While the code on my local windows server runs normally. The reason is: there is no php_zip.dll file in Linux (it does not work either... when an Excel file is uploaded under Linux and the output is displayed, an error "ZipArchive library is not enabled" is thrown. While the code on my local windows server runs normally.

The reason is: In Linux, there is no php_zip.dll file (or it will not work), so you need to re-compile the php zip module.
Solution in Unix/Linux:

1. run the following commands in sequence:

Cd/opt/lampp/
Wget http://pecl.php.net/get/zip (the latest version will be downloaded online by default, I use a zip-1.10.2.tgz here)
Tar-zxvf zip-1.10.2.tgz (package name downloaded)
CDS zip-1.10.2
/Opt/lampp/bin/phpize (corresponding phpize path find/-name phpize results/opt/lampp/bin/phpize)
./Configure -- with-php-config =/opt/lampp/bin/php-config (corresponding php-config path)
Make
Make instal

  

2. view the generated module path (after installation, the location of zip. so will be displayed on the screen ):
Cd/usr/lib/php/modules/(corresponding extensions path/usr/lib/php/modules /)

Installing shared extensions:/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/

3. modify php. ini as follows:


Added extension =/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/zip. so

Then change zlib. output_compression = Off to zlib. output_compression = On in the php. ini file;

4. restart the XAMPP service again:
/Opt/lampp stop
/Opt/lampp start

The zip module for php is installed and the ZipArchive class can be used in php.


Note: the solution in Windows is relatively simple:

1. in the php. ini file, remove the semicolon ";" Before extension = php_zip.dll.
Then change zlib. output_compression = Off to zlib. output_compression = On in the php. ini file;

2. restart the Apache server.

 

Note:

If you are prompted when you restart xampp:

Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/memcache. so '-/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/memcache. so: wrong ELF class: ELFCLASS64 in Unknown on line 0

It indicates that your operating system is 64-bit, and xampp only supports 32-bit systems. Download the following compressed package to replace the corresponding file.

Http://developerworks-ourplanet.googlecode.com/files/no-debug-non-zts-20090626.tar.gz

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.