Today, when uploading an Excel file under Linux, 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/usr/src wget http://pecl.php.net/get/zip (the latest version will be downloaded online by default) tar zxvf zip. x. x. tgz (downloaded package name) cd zip-1.x.x/usr/bin/phpize (corresponding phpize path find/-name phpize out result/usr/bin/phpize ). /configure -- with-php-config =/usr/bin/php-config (corresponding php-config path) 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 /)
3. Modify php. ini
Added extension = zip. so
Then change zlib. output_compression = Off to zlib. output_compression = On in the php. Ini file;
4. restart Apache:./apachectl restart;
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.