php-7.3.4 configure: error: Please reinstall the libzip distribution

本文介绍在CentOS 7.6环境下进行PHP 7.3.4源码安装过程中遇到的libzip依赖问题及解决方案。提供了两种解决方法:一是安装较旧版本libzip-1.2.0;二是安装最新版本libzip-1.5.2,并详细记录了每一步安装步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# 操作系统:

[root@localhost ~]# cat /etc/centos-release
**CentOS Linux release 7.6.1810 (Core)** 

## PHP 7.3.4 源码安装方式:


php 编译安装少依赖包很正常的,少什么装什么就好,这次和往常有些不一样,报了一个错误,网上搜索了一下整个错误大多都是复制黏贴,而且还是老版本的libzip-1.2.0,到官网看了下最新版已经是libzip-1.5.2 在网上找不到最新安装的方法,特别提供一个安装方法看样子偷懒的不是我一个!
## configure: error: Please reinstall the libzip distribution

## 编译参数如下:

   [root@localhost php-7.3.4]# ./configure --prefix=/usr/local/php \
    --with-zlib \
    --with-xmlrpc \
    --with-png-dir \
    --with-pear \
    --with-pdo-mysql=mysqlnd \
    --without-gdbm  \
    --with-openssl \
    --with-mysqli=mysqlnd \
    --with-mhash \
    --with-libxml-dir \
    --with-ldap=shared \
    --with-jpeg-dir \
    --with-iconv-dir \
    --with-gettext \
    --with-gd \
    --with-freetype-dir \
    --with-fpm-user=www \
    --with-fpm-group=www \
    --with-curl \
    --with-config-file-path=/usr/local/php/etc \
    --enable-zip \
    --enable-xml \
    --enable-sysvsem \
    --enable-sockets \
    --enable-soap \
    --enable-shmop \
    --enable-pcntl \
    --enable-opcache \
    --enable-mysqlnd-compression-support \
    --enable-mysqlnd \
    --enable-mbstring \
    --enable-mbregex \
    --enable-maintainer-zts \
    --enable-intl \
    --enable-inline-optimization \
    --enable-ftp \
    --enable-fpm \
    --enable-bcmath \
    --disable-rpath \
    --disable-fileinfo 

configure: error: Please reinstall the libzip distribution

## 以下内容在此版本无效

--enable-gd-native-ttf 
--with-libmbfl 
--with-mcrypt 
--enable-gd-jis-conv 

特别注意:  --enable-gd-jis-conv 此参数会导致Zabbix中文字符乱码,建议取消。
开始安装:

    make -j6 && make install

# 解决办法:

## 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后面有两个小数点)
    [root@localhost ~]# make -j4
    [root@localhost ~]# make test
    [root@localhost ~]# make install

# 注意这一步是不能直接./configure 的

## 解压之后内容如下:

   

 [root@localhost libzip-1.5.2]# ll
    total 124
    -rw-rw-r--. 1 root root  4533 Mar 12 07:44 API-CHANGES.md
    -rw-rw-r--. 1 root root  1603 Mar 12 07:44 appveyor.yml
    -rw-rw-r--. 1 root root    60 Mar 12 07:44 AUTHORS
    -rw-rw-r--. 1 root root  2698 Mar 12 07:44 cmake-config.h.in
    -rw-rw-r--. 1 root root 13184 Mar 12 07:44 CMakeLists.txt
    -rw-rw-r--. 1 root root  1253 Mar 12 07:44 cmake-zipconf.h.in
    drwxrwxr-x. 2 root root    69 Mar 12 07:44 examples
    -rw-rw-r--. 1 root root   808 Mar 12 07:44 FindNettle.cmake
    -rw-rw-r--. 1 root root  1693 Mar 12 07:44 INSTALL.md
    drwxrwxr-x. 2 root root  8192 Mar 12 07:44 lib
    -rw-rw-r--. 1 root root   291 Mar 12 07:44 libzip.pc.in
    -rw-rw-r--. 1 root root  1452 Mar 12 07:44 LICENSE
    drwxrwxr-x. 2 root root 12288 Mar 12 07:44 man
    -rw-rw-r--. 1 root root  6184 Mar 12 07:44 NEWS.md
    -rw-rw-r--. 1 root root  1931 Mar 12 07:44 README.md
    drwxrwxr-x. 2 root root 12288 Mar 12 07:44 regress
    drwxrwxr-x. 2 root root   111 Mar 12 07:44 src
    -rw-rw-r--. 1 root root  2900 Mar 12 07:44 THANKS
    -rw-rw-r--. 1 root root  6979 Mar 12 07:44 TODO.md
    [root@localhost libzip-1.5.2]# ls
    API-CHANGES.md     CMakeLists.txt      INSTALL.md    man        src
    appveyor.yml       cmake-zipconf.h.in  lib           NEWS.md    THANKS
    AUTHORS            examples            libzip.pc.in  README.md  TODO.md
    cmake-config.h.in  FindNettle.cmake    LICENSE       regress
    [root@localhost libzip-1.5.2]#

## 如下图:

## 有个 INSTALL . md  用 cat 命令查看内容

  [root@localhost libzip-1.5.2]# cat INSTALL.md
    libzip uses [cmake](https://cmake.org) to build.
    For running the tests, you need to have [perl](https://www.perl.org).
    You'll need [zlib](http://www.zlib.net/) (at least version 1.1.2). It
    comes with most operating systems.
    For supporting bzip2-compressed zip archives, you need
    [bzip2](http://bzip.org/).
    For AES (encryption) support, you need one of these cryptographic libraries,
    listed in order of preference:
    - Apple's CommonCrypto (available on macOS and iOS)
    - [GnuTLS](https://www.gnutls.org/)
    - [mbed TLS](https://tls.mbed.org/)
    - [OpenSSL](https://www.openssl.org/) >= 1.0.
    - Microsoft Windows Cryptography Framework
    If you don't want a library even if it is installed, you can
    pass `-DENABLE_<LIBRARY>=OFF` to cmake, where `<LIBRARY>` is one of
    `COMMONCRYPTO`, `GNUTLS`, `MBEDTLS`, or `OPENSSL`.
    
    The basic usage is
    
    ```sh
    mkdir build
    cd build
    cmake ..
    make
    make test
    make install
    ```
    Some useful parameters you can pass to `cmake` with `-Dparameter=value`:
    - `BUILD_SHARED_LIBS`: set to `ON` or `OFF` to enable/disable building
      of shared libraries, defaults to `ON`
    - `CMAKE_INSTALL_PREFIX`: for setting the installation path
    - `DOCUMENTATION_FORMAT`: choose one of 'man', 'mdoc', and 'html' for
      the installed documentation (default: decided by cmake depending on
      available tools)
    
    If you want to compile with custom `CFLAGS`, set them in the environment
    before running `cmake`:
    
    ```sh
    CFLAGS=-DMY_CUSTOM_FLAG cmake ..
    ```
    
    If you are compiling on a system with a small stack size, add
    `-DZIP_ALLOCATE_BUFFER` to `CFLAGS`.
    
    You can get verbose build output with by passing `VERBOSE=1` to
    `make`.
    You can also check the [cmake FAQ](https://cmake.org/Wiki/CMake_FAQ).
    [root@localhost libzip-1.5.2]#


 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值