centos安装PHP的zip扩展

[root@rhel6 ~]# tar zxvf libzip-1.2.0.tar.gz
[root@rhel6 ~]# cd libzip-1.2.0
[root@rhel6 ~]# ./configure
[root@rhel6 ~]# make & make install

安装完成之后编译php拓展

[root@rhel6 ~]# tar zxvf zip-1.14.0.tgz
[root@rhel6 ~]# cd zip-1.14.0/
[root@rhel6 ~]# phpize
[root@rhel6 ~]# make & make install

在执行make命令的时候,报错了

在包含自 /root/zip-1.14.0/php7/php_zip.h:31 的文件中,
                 从 /root/zip-1.14.0/php7/php_zip.c:31:
/usr/local/include/zip.h:59:21: 错误:zipconf.h:没有那个文件或目录
In file included from /root/zip-1.14.0/php7/php_zip.h:31,
                 from /root/zip-1.14.0/php7/php_zip.c:31:
/usr/local/include/zip.h:258: 错误:expected specifier-qualifier-list before ‘zip_int64_t’
In file included from /root/zip-1.14.0/php7/php_zip.h:31,
                 from /root/zip-1.14.0/php7/php_zip.c:31:
/usr/local/include/zip.h:285: 错误:expected specifier-qualifier-list before ‘zip_uint64_t’
/usr/local/include/zip.h:307: 错误:expected ‘=’, ‘,’, ‘;’, ‘asmor ‘__attribute__’ before ‘zip_flags_t’
/usr/local/include/zip.h:309: 错误:expected declaration specifiers or ‘...’ before ‘*’ token
/usr/local/include/zip.h:309: 错误:expected declaration specifiers or ‘...’ before ‘zip_uint64_t’
/usr/local/include/zip.h:309: 错误:‘zip_int64_t’声明为返回一个函数的函数
/usr/local/include/zip.h:390: 附注:需要类型‘int (*)()’,但实参的类型为‘long int’
/root/zip-1.14.0/php7/php_zip.c:299: 错误:提供给函数‘zip_source_file’的实参太多
/root/zip-1.14.0/php7/php_zip.c:303: 错误:提供给函数‘zip_file_add’的实参太多
/root/zip-1.14.0/php7/php_zip.c: 在函数‘php_zipobj_get_zip_comment’中:
/root/zip-1.14.0/php7/php_zip.c:469: 错误:提供给函数‘zip_get_archive_comment’的实参太多
/root/zip-1.14.0/php7/php_zip.c: 在函数‘php_zipobj_get_zip_comment’中:
/root/zip-1.14.0/php7/php_zip.c:469: 错误:提供给函数‘zip_get_archive_comment’的实参太多
/root/zip-1.14.0/php7/php_zip.c:1345: 错误:‘struct zip_stat’没有名为‘name’的成员
/root/zip-1.14.0/php7/php_zip.c:1348: 错误:‘struct zip_stat’没有名为‘comp_size’的成员
/root/zip-1.14.0/php7/php_zip.c:1351: 错误:‘struct zip_stat’没有名为‘size’的成员
/root/zip-1.14.0/php7/php_zip.c:1354: 错误:‘struct zip_stat’没有名为‘comp_method’的成员
/root/zip-1.14.0/php7/php_zip.c:1385: 错误:‘struct zip_stat’没有名为‘comp_method’的成员

定位错误zipconf.h:没有那个文件或目录,看来是找不到配置文件了,于是乎手动转移zipconf.h

[root@rhel6 ~]# cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
[root@rhel6 ~]# make & make install
...
...
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts/

编译成功,接下来在php目录下的etc/php.ini配置文件追加extension=zip.so
然后重启nginx,重新载入php配置文件



作者:HBLong
链接:https://www.jianshu.com/p/0f66e89978f5
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值