From ee80578fc6267d53cdcf27c7ccccce94222cb6fb Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Thu, 7 Oct 2021 22:49:24 +0800 Subject: [PATCH] php7.0 mongodb fixed version number --- php-fpm/Dockerfile | 16 +++++++++++----- workspace/Dockerfile | 24 +++++++++++++++--------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 46503669..44b296d2 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -358,12 +358,18 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ pecl install mongo && \ - docker-php-ext-enable mongo \ - ;else \ - pecl install mongodb && \ + docker-php-ext-enable mongo; \ + php -m | grep -oiE '^mongo$'; \ + else \ + if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ + pecl install mongodb-1.9.2; \ + else \ + pecl install mongodb; \ + fi; \ docker-php-ext-enable mongodb \ - ;fi \ -;fi + php -m | grep -oiE '^mongodb$'; \ + fi; \ +fi ########################################################################### # Xhprof: diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 1d525c41..092e7115 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -452,15 +452,21 @@ ARG INSTALL_MONGO=false RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install mongo && \ - echo "extension=mongo.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongo.ini && \ - ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongo.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-mongo.ini \ - ;else \ - pecl install mongodb && \ - echo "extension=mongodb.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongodb.ini && \ - ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongodb.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-mongodb.ini \ - ;fi \ -;fi + pecl install mongo; \ + echo "extension=mongo.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongo.ini; \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongo.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-mongo.ini; \ + php -m | grep -oiE '^mongo$'; \ + else \ + if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ + pecl install mongodb-1.9.2; \ + else \ + pecl install mongodb; \ + fi; \ + echo "extension=mongodb.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongodb.ini; \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/mongodb.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-mongodb.ini; \ + php -m | grep -oiE '^mongodb$'; \ + fi; \ +fi ########################################################################### # AMQP: