From 08dfc9f816b56453f625967967e9c9ddcc3e9595 Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Mon, 25 Jun 2018 20:16:25 +0800 Subject: [PATCH] php-fpm, workspace when php5 support old mongo ext. (#1642) --- php-fpm/Dockerfile | 4 ++++ workspace/Dockerfile | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 93078a91..b57f05eb 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -160,6 +160,10 @@ 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 && \ + docker-php-ext-enable mongo \ + ;fi && \ pecl install mongodb && \ docker-php-ext-enable mongodb \ ;fi diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 6b96aa7b..abc73c4d 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -292,7 +292,12 @@ ARG PHP_VERSION=${PHP_VERSION} RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension - pecl -q install mongodb && \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + pecl install mongo && \ + echo "extension=mongo.so" >> /etc/php/${PHP_VERSION}/mods-available/mongo.ini && \ + ln -s /etc/php/${PHP_VERSION}/mods-available/mongo.ini /etc/php/${PHP_VERSION}/cli/conf.d/30-mongo.ini \ + ;fi && \ + pecl install mongodb && \ echo "extension=mongodb.so" >> /etc/php/${PHP_VERSION}/mods-available/mongodb.ini && \ ln -s /etc/php/${PHP_VERSION}/mods-available/mongodb.ini /etc/php/${PHP_VERSION}/cli/conf.d/30-mongodb.ini \ ;fi