php7 安装zip扩展详细教程

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 16:36   1045   0

通过 php --ri zip 可查看zip拓展的详细信息

扩展包 wget http://pecl.php.net/get/zip-1.19.1.tgz (截止2020.10.19 最新版,其他版本可以到http://pecl.php.net页面搜索zip获取)

解压 并进入 tar -zxvf zip-1.19.1.tgz

cd  zip-1.19.1

/usr/local/php/bin/phpize  

./configure --with-php-config=/usr/local/php/bin/php-config   自己的php目录

make && make install

安装完成后会有 需要配置的   extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/zip.so

打开php.ini 在相应的地方写入extensions= /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/zip.so   搜索php.ini 位置  find / -name php.ini 

重启php服务

php -m  查看服务

常见问题:安装configure: error: Please reinstall the libzip distribution解决方案

# 解决办法:

1.使用老版本 (长期合作战略合作伙伴提供技术支持)libzip-1.2.0

[root@localhost ~]# wget https://nih.at/libzip/libzip-1.2.0.tar.gz

[root@localhost ~]# tar -zxvf libzip-1.2.0.tar.gz

[root@localhost ~]# cd libzip-1.2.0

[root@localhost ~]# ./configure

[root@localhost ~]# make -j4 && make install

2.使用最新版 (长期合作战略合作伙伴不提供技术支持**) libzip-1.5.2

[root@localhost ~]# wget https://libzip.org/download/libzip-1.5.2.tar.gz

[root@localhost ~]# tar -zxf libzip-1.5.2.tar.gz

[root@localhost ~]# cd libzip-1.5.2

[root@localhost ~]# mkdir build

[root@localhost ~]# cd build

[root@localhost ~]# cmake .. (#注意:cmake后面有两个小数点,如果报cmake找不到命令,可以直接用yum或apt-get安装)

[root@localhost ~]# make -j4

[root@localhost ~]# make test

[root@localhost ~]# make install

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP