Php: Unable to install imap extension

Created on 23 Jul 2015  路  8Comments  路  Source: docker-library/php

My docker file is as below

FROM php:5.6-apache
RUN docker-php-ext-install imap

The build command response is as below

Step 0 : FROM php:5.6-apache
 ---> ae9aedc28129
Step 1 : RUN docker-php-ext-install imap
 ---> Running in 452efdbc7561
+ cd /usr/src/php/ext/imap
+ phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
+ ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for IMAP support... yes, shared
checking for IMAP Kerberos support... no
checking for IMAP SSL support... no
checking for utf8_mime2text signature... new
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.
The command '/bin/sh -c docker-php-ext-install imap mcrypt' returned a non-zero code: 1
Makefile:9: recipe for target 'build' failed
make: *** [build] Error 1

How to install imap extension?

Most helpful comment

you must install dependencies for your extensions manually (hub)

So, this should work for imap:

RUN apt-get update && apt-get install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/lists/*
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
    && docker-php-ext-install imap

All 8 comments

you must install dependencies for your extensions manually (hub)

So, this should work for imap:

RUN apt-get update && apt-get install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/lists/*
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
    && docker-php-ext-install imap

Thanks. It worked.

@yosifkit Could you tell us the dependencies needed to get the imap extension working on Alpine Linux? 馃槃

Wondering if google is reading out emoji responses to page rank an result on github.com. They should do so.

There has not been an effort to compile the dependencies for php extensions using Alpine, but a user has made a script to get the dependencies easily for Debian: https://github.com/docker-library/php/issues/621.

works very well!

For those who look for IMAP with SSL on Alpine, this worked for us:

RUN set -xe && \
    apk add --update \
        imap-dev \
        openssl-dev && \
    apk add --no-cache --virtual .php-deps \
        make && \
    apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        krb5-dev \
    (docker-php-ext-configure imap --with-kerberos --with-imap-ssl) && \
    (docker-php-ext-install imap > /dev/null) && \
    apk del .build-deps

(or something like this, I've stripped not related packages).

Here is my 29/december/2020 answer (remix of @Wirone 's answer https://github.com/docker-library/php/issues/120#issuecomment-469634781)

FROM php:7-cli-alpine

RUN set -xe && \
    apk add --update --no-cache \
        imap-dev \
        openssl-dev \
        krb5-dev && \
    (docker-php-ext-configure imap --with-kerberos --with-imap-ssl) && \
    (docker-php-ext-install imap > /dev/null) && \
    php -m | grep -F 'imap'

Was this page helpful?
0 / 5 - 0 ratings