php-fpm, workspace when php5 support old mongo ext. (#1642)

This commit is contained in:
Shao Yu-Lung (Allen) 2018-06-25 20:16:25 +08:00 committed by GitHub
parent b71f50bf83
commit 08dfc9f816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -160,6 +160,10 @@ ARG INSTALL_MONGO=false
RUN if [ ${INSTALL_MONGO} = true ]; then \ RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension # 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 && \ pecl install mongodb && \
docker-php-ext-enable mongodb \ docker-php-ext-enable mongodb \
;fi ;fi

View File

@ -292,7 +292,12 @@ ARG PHP_VERSION=${PHP_VERSION}
RUN if [ ${INSTALL_MONGO} = true ]; then \ RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension # 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 && \ 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 \ ln -s /etc/php/${PHP_VERSION}/mods-available/mongodb.ini /etc/php/${PHP_VERSION}/cli/conf.d/30-mongodb.ini \
;fi ;fi