Skip to content

SSL error while connecting to MongoDB Atlas on Alpine builds #749

@pukkancs

Description

@pukkancs

Hi,

we are getting the below issue on the alpine image:

Fatal error: Uncaught MongoDB\Driver\Exception\InvalidArgumentException: Cannot create SSL client. SSL is not enabled in this build. in /var/www/myproject/vendor/mongodb/mongodb/src/Client.php:87

using

FROM php:7.2-fpm-alpine
WORKDIR /var/www

RUN apk add --no-cache --virtual .ext-deps \
        autoconf \
        g++ \
        make \
	pkgconf \
	libssl1.0 \
    && pecl install \
        redis \
        mongodb \
    && docker-php-ext-enable \
        redis \
        mongodb \
    && apk del .ext-deps

RUN pecl config-set php_ini /etc/php.ini

# Copy project files
COPY . /var/www/myproject/

We also tried without libssl1.0 as libressl seem to install it on the base build and several other things without being able to solve this.

Works fine on 7.2-fpm-stretch

FROM php:7.2-fpm-stretch
WORKDIR /var/www

RUN apt-get update && apt-get install --no-install-recommends -y \
        g++ \
        pkg-config \
        libssl-dev \
    && pecl install \
       mongodb \
       redis \
    && docker-php-ext-enable \
       mongodb \
       redis \
    && pecl config-set php_ini /etc/php.ini \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Copy project files
COPY . /var/www/myproject/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions