Skip to content
Advertisement

Docker / Symfony / MongoDB – Cannot install mongodb with PHP 5.6 FPM

I’m not able to install mongodb extension using php:5.6-fpm image. What’s wrong with my Dockerfile configuration ?

FROM php:5.6-fpm

RUN apt-get update 
    && mkdir -p /usr/share/man/man1 
    && mkdir -p /usr/share/man/man7 
    && apt-get install -y --no-install-recommends vim curl debconf subversion git apt-transport-https apt-utils 
    build-essential locales acl mailutils wget zip unzip htop vim 
    gnupg gnupg1 gnupg2 
    libmemcached-dev zlib1g-dev 
    libcurl4-openssl-dev pkg-config libssl-dev libicu-dev g++

RUN docker-php-ext-configure intl
RUN docker-php-ext-install pdo pdo_mysql zip intl

RUN pecl install mongodb
RUN docker-php-ext-enable mongodb

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

...
...

I have the following error when executing docker-compose build

Step 5/18 : RUN pecl install mongodb
 ---> Running in 5cd13b1b969c
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/mongodb requires PHP (version >= 7.0.0, version <= 7.99.99), installed version is 5.6.40
No valid packages found
install failed

Advertisement

Answer

Solution:

RUN pecl install mongodb-1.7.4
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement