Press "Enter" to skip to content

Docker中Centos7+PHP7.4.6安装libzip

注意:请避免在新系统上安装老旧软件,也避免在老系统上安装最新软件

原始问题

因本地docker镜像限制,最高支持Centos7,又想尝试安装PHP最新版,结果卡在安装libzip时报错:

checking for libzip >= 0.11... no
configure: error: Package requirements (libzip >= 0.11) were not met:

No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Dockerfile部分如下,参考了网上的做法 export 了环境配置,不知为啥仍然不起作用。

# libzip 在centos7上默认为0.10版本
RUN yum -y remove libzip libzip-devel
ADD https://libzip.org/download/libzip-1.7.0.tar.gz /usr/local/src/
WORKDIR /usr/local/src/libzip-1.7.0
RUN bash -c "mkdir build && cd build && cmake .. && make"
RUN bash -c "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH"

使用rpm安装解决

# Dockerfile part
# libzip upgrade
RUN yum -y remove libzip libzip-devel
RUN yum -y install https://rpms.remirepo.net/enterprise/7/remi/x86_64/libzip5-1.7.0-1.el7.remi.x86_64.rpm
RUN yum -y install https://rpms.remirepo.net/enterprise/7/remi/x86_64/libzip5-devel-1.7.0-1.el7.remi.x86_64.rpm

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code

提示