Merge pull request #2903 from laradock/php-mongodb

php mongodb
This commit is contained in:
Shao Yu-Lung (Allen) 2021-03-20 21:19:01 +08:00 committed by GitHub
commit fdfa279b33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 3 deletions

View File

@ -308,6 +308,7 @@ services:
- INSTALL_IMAGEMAGICK=${PHP_WORKER_INSTALL_IMAGEMAGICK} - INSTALL_IMAGEMAGICK=${PHP_WORKER_INSTALL_IMAGEMAGICK}
- INSTALL_GMP=${PHP_WORKER_INSTALL_GMP} - INSTALL_GMP=${PHP_WORKER_INSTALL_GMP}
- INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL}
- INSTALL_MONGO=${PHP_WORKER_INSTALL_MONGO}
- INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH} - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH}
- INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8} - INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8}
- INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON} - INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON}

View File

@ -278,6 +278,7 @@ PHP_WORKER_INSTALL_IMAGEMAGICK=false
PHP_WORKER_IMAGEMAGICK_VERSION=latest PHP_WORKER_IMAGEMAGICK_VERSION=latest
PHP_WORKER_INSTALL_GMP=false PHP_WORKER_INSTALL_GMP=false
PHP_WORKER_INSTALL_PGSQL=false PHP_WORKER_INSTALL_PGSQL=false
PHP_WORKER_INSTALL_MONGO=false
PHP_WORKER_INSTALL_BCMATH=false PHP_WORKER_INSTALL_BCMATH=false
# PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version # PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version
PHP_WORKER_INSTALL_OCI8=false PHP_WORKER_INSTALL_OCI8=false

View File

@ -35,7 +35,7 @@ RUN apk --update add wget \
procps procps
RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl
RUN pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 mongodb && docker-php-ext-enable memcached mongodb RUN pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached
# Add a non-root user to help install ffmpeg: # Add a non-root user to help install ffmpeg:
ARG PUID=1000 ARG PUID=1000

View File

@ -38,9 +38,9 @@ RUN apk --update add wget \
RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
pecl channel-update pecl.php.net && pecl install memcached-2.2.0 mcrypt-1.0.1 mongodb && docker-php-ext-enable memcached mongodb \ pecl channel-update pecl.php.net && pecl install memcached-2.2.0 mcrypt-1.0.1 && docker-php-ext-enable memcached \
;else \ ;else \
pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 mongodb && docker-php-ext-enable memcached mongodb \ pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached \
;fi ;fi
# Add a non-root user: # Add a non-root user:
@ -108,6 +108,18 @@ RUN if [ ${INSTALL_SOAP} = true ]; then \
docker-php-ext-install soap \ docker-php-ext-install soap \
;fi ;fi
# Install MongoDB drivers:
ARG INSTALL_MONGO=false
RUN if [ ${INSTALL_MONGO} = true ]; then \
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 mongodb; \
fi; \
fi
#Install BCMath package: #Install BCMath package:
ARG INSTALL_BCMATH=false ARG INSTALL_BCMATH=false
RUN if [ ${INSTALL_BCMATH} = true ]; then \ RUN if [ ${INSTALL_BCMATH} = true ]; then \
@ -350,6 +362,16 @@ RUN if [ ${INSTALL_XMLRPC} = true ]; then \
docker-php-ext-install xmlrpc \ docker-php-ext-install xmlrpc \
;fi ;fi
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
pecl install mongo; \
docker-php-ext-enable mongo; \
php -m | grep -q 'mongo'; \
else \
pecl install mongodb; \
docker-php-ext-enable mongodb; \
php -m | grep -q 'mongodb'; \
fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Optional Supervisord Configuration # Optional Supervisord Configuration