搜索
查看: 4562|回复: 0

centos安装PHP的zip扩展

[复制链接]

330

主题

177

回帖

1071

积分

vip用户

积分
1071

注册会员活跃会员热心会员

QQ
发表于 2018-6-30 10:50:51 | 显示全部楼层 |阅读模式
[pre]
[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
[/pre]
安装完成之后编译php拓展
[pre]
[root@rhel6 ~]# tar zxvf zip-1.14.0.tgz
[root@rhel6 ~]# cd zip-1.14.0/
[root@rhel6 ~]# phpize
[root@rhel6 ~]# make & make install
[/pre]
在执行make命令的时候,报错了
[pre]
在包含自 /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 ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__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’的成员
[/pre]
定位错误zipconf.h:没有那个文件或目录,看来是找不到配置文件了,于是乎手动转移zipconf.h
[pre]
[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/
[/pre]
编译成功,接下来在php目录下的etc/php.ini配置文件追加extension=zip.so
然后重启nginx,重新载入php配置文件

有没有参加CTF比赛的,一起组队啊!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表