php7 安装zip扩展详细教程
2022-07-28 15:20:24
270
{{single.collect_count}}

通过 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

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}