我在尝试让 imap 与我的 docker-compose 一起工作时遇到问题。
这是我的 php dockerfile 的样子。
FROM php:7.2-fpm
RUN apt-get update && \
apt-get install -y \
curl \
libmcrypt-dev \
unzip \
git
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-
dir=/usr/local/bin --filename=composer
RUN composer --version
# Set timezone to UTC
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/UTC /etc/localtime
RUN "date"
RUN apt-get -y install libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& rm -r /var/lib/apt/lists/*
RUN /usr/local/bin/docker-php-ext-install pdo pdo_mysql
ADD ./scripts/entry.sh /root/init.sh
WORKDIR /var/www/insight
但是我一直报错
Call to undefined function imap_open()
我一直在尝试很多不同的方法来让 imap 工作,但似乎没有任何一种对我有用。我需要继续使用 php7.2,所以降级到 php5 对我来说不是一个选择。
我理想的结果是保留当前的 php 版本的 fpm 并找到一个很好的解决方案来让 imap 与当前的 dockerfile 一起工作。
添加
Docker-php-ext-install imap
在 dockerfile 中似乎不起作用并导致以下错误:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
最佳答案
要在 Docker 中使用带有 PHP 的 imap 模块,您必须像这样配置扩展
docker-php-ext-configure imap --with-kerberos --with-imap-ssl
您可以在我的 project 中看到一个 Dockerfile 示例
关于php - docker php7.2-fpm无法安装imap模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49854767/