dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
阅读:343回复:0

如何为 Docker容器添加 php imap扩展?

楼主#
更多 发布于:2018-05-29 11:17
问题描述
php:5.6-fpm 容器,安装 imap 扩展提示 configure: error: utf8_mime2text() has new signature ...

docker-php-ext-install imap
checking for U8T_DECOMPOSE...
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

环境
Debian 8.9 On php:5.6-fpm
Docker 17.05.0-ce

解决方法
1. imap 依赖 libc-client-dev 与 libkrb5-dev 系统组件,需要提前安装它们。
apt-get update && apt-get install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/lists/*

2. 安装扩展
docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap

3. 验证
php -m | grep imap
imap

扩展: Dockerfile (nginx+php 定制镜像)
# php-fpm:5.6
# 2018.05.28

FROM     php:5.6-fpm
MAINTAINER dongnan <http://zongming.net>

# apt
COPY conf/sources.list /etc/apt/sources.list
RUN apt-get update \
    && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libmagickwand-dev \
        libmemcached-dev \
        bzip2 \
        supervisor cron nginx \
        libc-client-dev libkrb5-dev \
    && apt-get clean \
    && rm -r /var/lib/apt/lists/*

# php ext
RUN docker-php-ext-install bcmath \
    dba \
    exif \
    mysqli \
    pdo_mysql \
    sysvsem \
    sysvshm \
    bz2 \
    zip \
    mysql

RUN docker-php-ext-install -j$(nproc) iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd
#
RUN pecl install imagick \
    memcached-2.2.0 \
    redis \
    && docker-php-ext-enable imagick \
    && docker-php-ext-enable memcached \
    && docker-php-ext-enable redis
# imap
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap

# php
COPY conf/php.ini /usr/local/etc/php/php.ini
COPY conf/php-www.conf /usr/local/etc/php-fpm.d/www.conf
COPY conf/php-docker.conf /usr/local/etc/php-fpm.d/docker.conf

# nginx
COPY conf/nginx.conf /etc/nginx/nginx.conf
COPY conf/default.conf /etc/nginx/conf.d/default.conf

# cron
COPY conf/crontab /var/spool/cron/crontabs/root
RUN chmod 600 /var/spool/cron/crontabs/root

# supervisor
RUN mkdir -p /var/log/supervisor &&  mkdir -p /var/log/php
COPY conf/supervisord.conf /etc/supervisor/supervisord.conf

# port
EXPOSE 80

#
CMD ["/usr/bin/supervisord","-c","/etc/supervisor/supervisord.conf"]

参考: 定制 php:5.6-fpm Dockerfile
#
游客

返回顶部