解决PHP报错ZipArchive library is not enabled异常的方法
来源:互联网 发布:老版本mac如何升级系统 编辑:程序博客网 时间:2024/06/07 14:16
解决PHP报错ZipArchive library is not enabled异常的方法
今天在Linux底下上传Excel文件时,抛出“ZipArchive library is not enabled” 的异常。而我在本地的windows下的代码则是运行正常的。
原因是:在Linux下没有php_zip.dll这个文件(有也不会起作用的),所以需要重新编译一下php的zip模块。
在Unix/Linux下的解决办法 :
1、依次运行如下命令:
cd /usr/src wget http://pecl.php.net/get/zip (默认会在线下载最新版本的) tar zxvf zip.x.x.tgz (所下载的包名) cd zip-1.x.x /usr/bin/phpize (对应的phpize路径 find / -name phpize 出来结果/usr/bin/phpize) ./configure --with-php-config=/usr/bin/php-config (对应的php-config路径) make make instal
2、查看生成的模块路径(安装完之后,屏幕上会提示zip.so的位置):
cd /usr/lib/php/modules/ (对应的extensions路径 /usr/lib/php/modules/)
3、修改php.ini
增加 extension=zip.so
然后同样在php.ini文件中,将zlib.output_compression = Off 改为 zlib.output_compression = On ;
4、最后再重启一下Apache:./apachectl restart ;
这个针对php的zip模块就安装完成了,能够在php中使用ZipArchive类了。
附:在Windows下的解决办法就比较简单了 :
1、在php.ini文件中,将extension=php_zip.dll前面的分号“;”去除
然后同样在php.ini文件中,将 zlib.output_compression = Off 改为 zlib.output_compression = On ;
2、重启Apache服务器。
- 解决PHP报错ZipArchive library is not enabled异常的方法
- PHPExcel 错误Fatal error: ZipArchive library is not enabled
- Android Virtual Device解决Dpad is not enabled的问题
- php Class 'ZipArchive' not found的解决办法
- php Class 'ZipArchive' not found的解决办法
- php报Class ZipArchive not found,安装zip扩展
- Hibernate报错“usinfo is not mapped”的解决原因及方法
- Stencil buffer is not enabled.的问题解决
- Sybase修改表字段时,报错“the 'select into 'database option is not enabled ”
- Second-level cache is not enabled for usage 异常
- Aggregation is not enabled.
- VB6在64位WIN7系统加载组件报错:Object library not registered 的解决
- Subversion Native Library Not Available 解决异常
- ibatis的sqlmap.xml 报错:Content is not allowed in prolog异常的原因
- 解决Driver not loaded报错的方法
- 报 partial is not defined异常 解决方法?
- firefox 使用 jquery 报错:$ is not defined解决
- ElasticSearch path.home is not configured报错解决
- UNION
- bzoj4176 Lucas 的数论
- GIT——基本操作
- oracle 中 Flashback table功能恢复某个表数据!!
- hdoj1045 Fire Net(dfs)
- 解决PHP报错ZipArchive library is not enabled异常的方法
- 经典算法之插入排序(直接插入排序、shell排序)
- LeetCode 131. Palindrome Partitioning
- js删除数组中的元素
- [四]Spring Boot 整合Mybatis
- 运行mongodb创建data库时出现计算机丢失api-ms-win-crt-runtime-|1-1-0.dll
- MyEclipse自动生成访问器
- 2.搭建开发环境所需的工具
- Delphi程序引用C#:报缺DCU文件。。。