Josef Sábl
Josef Sábl

Reputation: 7752

Cannot install MongoDB PHP Extension in Docker

This is my Dockerfile

FROM php:7.4.0-fpm-alpine

RUN cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

RUN pecl config-set php_ini "$PHP_INI_DIR"

RUN apk add --no-cache pcre-dev ${PHPIZE_DEPS}

RUN pecl install mongodb-1.6.1 \
  && docker-php-ext-enable mongodb

RUN apk del pcre-dev ${PHPIZE_DEPS}

CMD ["php-fpm"]

EXPOSE 9000

But I get the: configuration option "php_ini" is not set to php.ini location and suggestion to add the line to the ini file manually (which I don't want to do for other reasons).

Upvotes: 0

Views: 2320

Answers (1)

Josef Sábl
Josef Sábl

Reputation: 7752

Found out I need to actually do:

RUN pear config-set php_ini "$PHP_INI_DIR"

Upvotes: 3

Related Questions