php安装zip扩展

PHP当前最新版本是PHP7.3,今天在尝试安装的过程中报如下错误

system libzip must be upgraded to version >= 0.11

根据提示我们可以清楚的知道是因为系统自带的libzip版本低了,这里我们需要安装最新的libzip

首先,卸载系统自带的libzip

yum -y remove libzip-devel

然后从官网下载并编译安装

wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar xvf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure
make && make install

如果是下载1.5.*以上版本,则需要采用如下安装方式

yum -y install cmake
wget https://libzip.org/download/libzip-1.5.1.tar.gz
tar -zxvf libzip-1.5.1.tar.gz
cd libzip-1.5.1
mkdir build
cd build
cmake ..
make && make install

安装cmake

下载地址:https://cmake.org/download/

wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz

编译安装

tar xf cmake-3.13.2.tar.gz
cd cmake-3.13.2
./bootstrap --prefix=$HOME/local
make && make install

检查安装

export PATH=$HOME/local/bin:$PATH
cmake --version
 
    cmake version 3.13.2
 
    CMake suite maintained and supported by Kitware (kitware.com/cmake).

No package 'libzip' found

安装完成后,查看是否存在/usr/local/lib/pkgconfig目录,如果存在,执行如下命令来设置PKG_CONFIG_PATH:

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
Last modification:November 27, 2021
如果觉得我的文章对你有用,请随意赞赏