php - 更新mac os后为docker构建php-fpm时phpize失败
问题描述
在我将我的 mac os 从 11.4 更新到 11.6 之后,我失去了为 docker 构建 php 映像的能力。在更新之前,一切都在顺利构建,但在更新之后,我似乎根本无法使用任何额外的扩展来构建 php-fpm。
因此,如果我的 Dockerfile 完全没有任何扩展名,则将构建
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
libfreetype6-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libpng-dev \
libonig-dev \
libzip-dev \
libmcrypt-dev \
libpq-dev
CMD ["php-fpm"]
但是,如果我的 dockerfile 中有任何扩展名,则在尝试安装第一个时构建将失败。所以有了这样的 dockerfile
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
libfreetype6-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libpng-dev \
libonig-dev \
libzip-dev \
libmcrypt-dev \
libpq-dev
RUN pecl install mcrypt-1.0.4
RUN docker-php-ext-enable mcrypt
RUN docker-php-ext-install -j$(nproc) iconv
RUN docker-php-ext-install -j$(nproc) mbstring
RUN docker-php-ext-install -j$(nproc) mysqli
RUN docker-php-ext-install -j$(nproc) pdo_mysql
RUN docker-php-ext-install -j$(nproc) zip
RUN pecl install -o redis && docker-php-ext-enable redis
CMD ["php-fpm"]
我收到这样的错误
=> ERROR [ 3/12] RUN pecl install mcrypt-1.0.4 3.7s
------
> [ 3/12] RUN pecl install mcrypt-1.0.4:
#6 3.043 downloading mcrypt-1.0.4.tgz ...
#6 3.044 Starting to download mcrypt-1.0.4.tgz (27,056 bytes)
#6 3.157 .........done: 27,056 bytes
#6 3.196 6 source files, building
#6 3.196 running: phpize
#6 3.208 Configuring for:
#6 3.208 PHP Api Version: 20190902
#6 3.208 Zend Module Api No: 20190902
#6 3.208 Zend Extension Api No: 320190902
#6 3.354 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 272, <GEN0> line 66.
#6 3.354 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 278, <GEN0> line 66.
#6 3.355 Use of uninitialized value $type in string eq at /usr/bin/autom4te line 284, <GEN0> line 66.
#6 3.355 Use of uninitialized value $type in concatenation (.) or string at /usr/bin/autom4te line 292, <GEN0> line 66.
#6 3.355 autom4te: /usr/share/autoconf/autom4te.cfg:66: unknown directive:
#6 3.718 ERROR: `phpize' failed
------
executor failed running [/bin/sh -c pecl install mcrypt-1.0.4]: exit code: 1
根据我尝试安装的扩展名,错误会有所不同
=> ERROR [3/8] RUN docker-php-ext-install -j$(nproc) iconv 4.2s
------
> [3/8] RUN docker-php-ext-install -j$(nproc) iconv:
#6 3.155 Configuring for:
#6 3.155 PHP Api Version: 20190902
#6 3.155 Zend Module Api No: 20190902
#6 3.155 Zend Extension Api No: 320190902
#6 3.769 Can't export symbol: US_GLOBAL at /usr/share/autoconf/Autom4te/FileUtils.pm line 42.
#6 3.769 BEGIN failed--compilation aborted at /usr/share/autoconf/Autom4te/FileUtils.pm line 42.
#6 3.769 Compilation failed in require at /usr/bin/autom4te line 40.
#6 3.769 BEGIN failed--compilation aborted at /usr/bin/autom4te line 40.
#6 3.772 autoheader: '/usr/bin/autom4te' failed with exit status: 255
------
executor failed running [/bin/sh -c docker-php-ext-install -j$(nproc) iconv]: exit code: 1
但是仍然无法找到有关这些错误的任何信息。
我已经尝试重新安装开发人员工具和 brew,但仍然无法构建带有任何扩展的 php 映像。
解决方案
我花了 4 天时间,疯狂地用谷歌搜索,完全卸载了我的系统很多次,包括安装 mac os 10.12 的测试版,但是......
...由于某些绝对奇怪的原因,该图像无法构建FROM php:7.4-fpm
(尽管之前已成功构建),但将FROM php:7.4.0-fpm
在 Dockerfile 中构建
推荐阅读
- android - 根据结果更改 Alertdialog 的 Imageview
- c# - 加入Linq时如何使用表达式获取动态谓词
- c# - 如何防止使用 SQL 加载的浮点 Excel 数据被截断
- google-analytics - 在 Google Analytics 中:如何在一份报告中组合来自多个子域的数据?
- html - 打印带有固定标题的html表格
- django - 如何强制插入 wagtail Draftail 编辑器中的外部 URL 在新选项卡上打开?
- html - 垂直对齐列表组引导
- docker - docker run 打开一个 X 窗口并保持空闲
- node.js - Twilio 节点 - 浏览器调用 StatusCallback 事件
- java - 如何从eclipse的IResource接口获取文件内容