I'm having problems trying to get imap working with my docker-compose.
Here is what my php dockerfile looks like.
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
But I keep getting the error
Call to undefined function imap_open()
I've been trying a lot of different ways of getting the imap to work, but nothing seems to be working for me. I need to keep using php7.2 so downgrading to php5 is not an option for me.
My ideal outcome is to keep the current php version of fpm and find a nice solution to get imap working with the current dockerfile.
Adding
Docker-php-ext-install imap
inside the dockerfile does not seem to work and result with the following error:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
To use imap module with PHP in Docker you must configure extension like this
docker-php-ext-configure imap --with-kerberos --with-imap-ssl
You can see an example of Dockerfile in one of my project
Actual in 2020 for PHP 7.4 and PHP 8 on Linux Alpine
RUN apk add imap-dev krb5-dev
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap \
&& docker-php-ext-enable imap
Solved it by using
RUN apt update && apt install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap
Found at https://stackoverflow.com/a/52314180/2311074
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With