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