Php: Unable to install IMAP extension (Alpine Linux)

Created on 16 Jun 2016  路  6Comments  路  Source: docker-library/php

In continuation of #120, I'm getting the same error when trying to install the imap extension on the alpine linux image:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

My Dockerfile:

FROM php:5-fpm-alpine

RUN apk upgrade --update && apk add \
      php5-imap autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
      coreutils \
      freetype-dev \
      libjpeg-turbo-dev \
      libltdl \
      libmcrypt-dev \
      libpng-dev \
      libc-client-dev \
    && docker-php-ext-configure imap --with-imap --with-imap-ssl \
    && docker-php-ext-install imap \
    && docker-php-ext-install iconv mcrypt mysqli mysqlnd pdo pdo_mysql zip bcmath \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && apk del autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
    && rm -rf /var/cache/apk/*

COPY ./php.ini /usr/local/etc/php/php.ini

Can anyone point me in the right direction to get this working? Maybe @tianon? 馃槃 Thanks!

Most helpful comment

Hi @mvdstam ,

libc-client-dev package doesn't exist on alpine.
You need to install imap-dev

Enjoy ! 馃槃

All 6 comments

Hi @mvdstam ,

libc-client-dev package doesn't exist on alpine.
You need to install imap-dev

Enjoy ! 馃槃

Hey @yanntech!

Thanks a lot for helping out. Still getting used to Alpine linux. For those interested, my full Dockerfile is as follows:

FROM php:5-fpm-alpine

RUN apk upgrade --update && apk add \
      autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
      coreutils \
      freetype-dev \
      libjpeg-turbo-dev \
      libltdl \
      libmcrypt-dev \
      libpng-dev \
      imap-dev \
      openssl-dev \
    && docker-php-ext-install iconv mcrypt mysqli mysqlnd pdo pdo_mysql zip bcmath \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && docker-php-ext-configure imap --with-imap --with-imap-ssl \
    && docker-php-ext-install imap

RUN pecl install xdebug \
    && docker-php-ext-enable xdebug \
    && apk del autoconf file g++ gcc binutils isl libatomic libc-dev musl-dev make re2c libstdc++ libgcc binutils-libs mpc1 mpfr3 gmp libgomp \
    && rm -rf /var/cache/apk/*

COPY ./php.ini /usr/local/etc/php/php.ini

Thanks again!

my dockerfile is here

ARG PHP_VERSION=7.2
ARG NGINX_VERSION=1.15
ARG VARNISH_VERSION=6.0

FROM php:${PHP_VERSION}-fpm-alpine AS api_platform_php

# persistent / runtime deps
RUN apk add --no-cache \
        acl \
        file \
        gettext \
        git \
        mysql-client \
    ;

ARG APCU_VERSION=5.1.11
RUN set -eux; \
    apk add --no-cache --virtual .build-deps \
        icu-dev \
        libzip-dev \
        mysql-dev \
        zlib-dev \
        imap-dev \
    ; \
    \
    docker-php-ext-configure zip --with-libzip; \
    docker-php-ext-configure imap --with-imap --with-imap-ssl; \
    docker-php-ext-install -j$(nproc) \
        intl \
        pdo_mysql \
        zip \
        imap \
    ; \
    pecl install \
        apcu-${APCU_VERSION} \
    ; \
    pecl clear-cache; \
    docker-php-ext-enable \
        apcu \
        opcache \
        imap \
    ; \
    \

any error in this i will get error while building

Still having a problem installing IMAP on Alpine PHP image. Here is my Dockerfile:

FROM php:7.3-fpm-alpine

RUN apk --update --virtual build-deps add \
        autoconf \
        make \
        gcc \
        g++ \
        libtool \
        icu-dev \
        curl-dev \
        freetype-dev \
        imagemagick-dev \
        libzip-dev \
        pcre-dev \
        libjpeg-turbo-dev \
        libpng-dev \
        imap-dev \
        openssl-dev \
        libxml2-dev
RUN apk add \
        git \
        curl \
        bash \
        bash-completion \
        icu \
        pcre \
        zip \
        imap \
        openssl \
        freetype \
        libintl \
        libjpeg-turbo \
        libpng \
        libltdl \
        libxml2 \
        libzip
RUN docker-php-ext-configure bcmath && \
    docker-php-ext-configure zip --with-libzip && \
    docker-php-ext-configure imap --with-imap --with-imap-ssl
RUN docker-php-ext-install \
        zip \
        imap \
        curl \
        bcmath \
        exif \
        iconv \
        intl \
        mbstring \
        opcache
RUN pecl install \
        imagick \
        redis
RUN docker-php-ext-enable \
        redis \
        imap
RUN apk del \
        build-deps

And warning:

PHP Warning:  PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so (Error loading shared library libc-client.so.1: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20180731/imap.so.so: No such file or directory)) in Unknown on line 0

Includind libc-client is impossible. What can I do to make it work?

@DarthLegiON, probably need to keep imap-dev installed since it is providing /usr/lib/libc-client.so (or just c-client for /usr/lib/libc-client.so.1): https://pkgs.alpinelinux.org/contents?file=libc-client.so*&path=&name=&branch=v3.10&arch=x86_64

You may also want to combine your RUN lines into a single line, otherwise you won't see any space saving from the deletes.

@yosifkit thanks for advices!

Was this page helpful?
0 / 5 - 0 ratings