Alpine Linux PHP 7 Docker Image install mysql extension without mysqlnd

Viewed 3509

I am trying to build a docker image with php 7 based on alpine:3.6. However, one of the requirement is not to use mysqlnd for pdo_mysql and mysqli, which is somehow installed by default if I installed the php through apk add.

Here is the part of Dockerfile which install the php 7 :

RUN echo 'http://dl-cdn.alpinelinux.org/alpine/3.6/main' >> /etc/apk/repositories && \
apk --update add \
    php7 \
    php7-bcmath \
    php7-dom \
    php7-ctype \
    php7-curl \
    php7-fileinfo \
    php7-fpm \
    php7-gd \
    php7-iconv \
    php7-intl \
    php7-json \
    php7-mbstring \
    php7-mcrypt \
php7-mysqli \
php7-opcache \
    php7-openssl \
php7-redis \
    php7-pdo \
    php7-pdo_mysql \
    php7-pdo_pgsql \
    php7-pdo_sqlite \
    php7-phar \
    php7-posix \
    php7-session \
    php7-soap \
    php7-xml \
    php7-xmlreader \
    php7-xmlwriter \
    php7-zip \
    php7-dev \
    php7-pear \
&& apk add --no-cache pcre-dev@latest-stable && \
apk add --no-cache --virtual .mongodb-ext-build-deps openssl-dev && \
pecl install mongodb && \
pecl clear-cache && \
apk del .mongodb-ext-build-deps && \
rm -rf /var/cache/apk/*

When I printed the phpinfo(), mysqli and pdo_mysql will use mysqlnd (which is what I don't want it to be). Any idea how I could work it out?

result of phpinfo on mysqli

result of phpinfo on mysqli

========================================================================== The reason why I don't want to use mysqlnd is because other clients that will fetch the data from this server will crash if the pdo_mysql return native data field. Is there anyway around to make sure the pdo_mysql return string even though mysqlnd is installed?

0 Answers
Related