0

我正在尝试使用 docker 文件在 CentOS 上安装 Install PHP 7.1,但看起来有些错误总是停止,

Dockerfile:

FROM centos:7

# Install some must-haves
RUN yum -y install vim wget sendmail
RUN yum -y install libtool make automake autoconf nasm libpng-static
RUN yum -y install git
RUN git --version

# Install PHP 7.1 on CentOS
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
    && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    
RUN yum update -y
RUN yum install yum-utils
RUN yum-config-manager --enable remi-php71

RUN yum -y install php71w php71w-bcmath php71w-cli php71w-common php71w-curl php71w-fpm php71w-gd php71w-ldap php71w-imap php71w-intl php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-opcache php71w-pdo php71w-pear php71w-pecl-apcu php71w-pecl-imagick php71w-pgsql php71w-process php71w-pspell php71w-recode php71w-soap php71w-tidy php71w-xml

RUN php -v

错误:

--> Running transaction check
---> Package libX11-common.noarch 0:1.6.7-3.el7_9 will be installed
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64
---> Package php71w-pecl-imagick.x86_64 0:3.4.3-1.w7 will be installed
--> Processing Dependency: libMagickWand.so.5()(64bit) for package: php71w-pecl-imagick-3.4.3-1.w7.x86_64
--> Processing Dependency: libMagickCore.so.5()(64bit) for package: php71w-pecl-imagick-3.4.3-1.w7.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package php71w-pecl-imagick.x86_64 0:3.4.3-1.w7 will be installed
--> Processing Dependency: libMagickWand.so.5()(64bit) for package: php71w-pecl-imagick-3.4.3-1.w7.x86_64
--> Processing Dependency: libMagickCore.so.5()(64bit) for package: php71w-pecl-imagick-3.4.3-1.w7.x86_64
--> Finished Dependency Resolution
Error: Package: php71w-pecl-imagick-3.4.3-1.w7.x86_64 (webtatic)
           Requires: libMagickWand.so.5()(64bit)
Error: Package: php71w-pecl-imagick-3.4.3-1.w7.x86_64 (webtatic)
           Requires: libMagickCore.so.5()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
ERROR: Service 'laravel-env' failed to build : The command '/bin/sh -c yum -y install php71w php71w-bcmath php71w-cli php71w-common php71w-curl php71w-fpm php71w-gd php71w-ldap php71w-imap php71w-intl php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-opcache php71w-pdo php71w-pear php71w-pecl-apcu php71w-pecl-imagick php71w-pgsql php71w-process php71w-pspell php71w-recode php71w-soap php71w-tidy php71w-xml' returned a non-zero code: 1

关于发生了什么以及出了什么问题的任何想法?我是否缺少 dockerFile 中的任何配置?

4

1 回答 1

0

您正在尝试从“ webtatic ”(php71w* 包)安装 php 7.1

此存储库已死、无人维护(最后一次更改是 2019 年),并且因 CentOS 的最近更改(例如 IMageMagick rebase)而损坏。

运行 yum-config-manager --enable remi-php71

要从“ remi ”存储库正确安装 PHP,请按照向导说明进行操作

所以,像

RUN yum -y install php php-bcmath php-cli php-common php-curl php-fpm php-gd php-ldap php-imap php-intl php-mbstring php-mcrypt php-mysqlnd php-opcache php-pdo php-pear php-pecl-apcu php-pecl-imagick php-pgsql php-process php-pspell php-recode php-soap php-tidy php-xml

注意:你不需要“php”(用于 apache 的 mod_php)和“php-fpm”(用于任何 Web 服务器的 FPM 服务)

注意PHP 7.1已于 2019 年 12 月结束生命周期,即使“remi”存储库提供了一些最低限度的安全修复,我衷心建议更新到受支持的版本。

于 2021-05-11T05:21:00.007 回答