From 9536c2e63f4fd65ea3a89a3a210fbd077283c870 Mon Sep 17 00:00:00 2001 From: Wuweiming <1052701694@qq.com> Date: Thu, 16 Dec 2021 15:17:19 +0800 Subject: [PATCH] fix:Add php xlswriter extension --- php-fpm/Dockerfile | 14 +++++++------- php-worker/Dockerfile | 16 ++++++++-------- workspace/Dockerfile | 12 ++++++++---- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 7c4560ed..cf0ed15e 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -488,8 +488,6 @@ RUN if [ ${INSTALL_GEARMAN} = true ]; then \ docker-php-ext-enable gearman \ ;fi - - ########################################################################### # xlswriter: ########################################################################### @@ -498,13 +496,15 @@ ARG INSTALL_XLSWRITER=false RUN set -eux; \ if [ ${INSTALL_XLSWRITER} = true ]; then \ # Install Php xlswriter Extension \ - pecl install xlswriter; \ - docker-php-ext-enable xlswriter; \ - php -m | grep -q 'xlswriter'; \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") > "5" ]; then \ + pecl install xlswriter; \ + docker-php-ext-enable xlswriter; \ + php -m | grep -q 'xlswriter'; \ + else \ + echo "PHP Extension for xlswriter is not supported for PHP 5.0"\ + fi; \ fi - - ########################################################################### # pcntl ########################################################################### diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index 48decbd4..dd2c58a3 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -367,24 +367,24 @@ RUN set -eux; \ php -m | grep -oiE '^swoole$'; \ fi - - - - ########################################################################### # xlswriter: ########################################################################### ARG INSTALL_XLSWRITER=false + RUN set -eux; \ if [ ${INSTALL_XLSWRITER} = true ]; then \ # Install Php xlswriter Extension \ - pecl install xlswriter; \ - docker-php-ext-enable xlswriter; \ - php -m | grep -q 'xlswriter'; \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") > "5" ]; then \ + pecl install xlswriter; \ + docker-php-ext-enable xlswriter; \ + php -m | grep -q 'xlswriter'; \ + else \ + echo "PHP Extension for xlswriter is not supported for PHP 5.0"; \ + fi; \ fi - ########################################################################### # Taint EXTENSION ########################################################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index cb4a10c3..ac00287e 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -575,10 +575,14 @@ ARG INSTALL_XLSWRITER=false RUN set -eux; \ if [ ${INSTALL_XLSWRITER} = true ]; then \ # Install Php xlswriter Extension - echo '' | pecl -q install xlswriter; \ - echo "extension=xlswriter.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/xlswriter.ini; \ - ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/xlswriter.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-xlswriter.ini; \ - php -m | grep -q 'xlswriter'; \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") > "5" ]; then \ + echo '' | pecl -q install xlswriter; \ + echo "extension=xlswriter.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/xlswriter.ini; \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/xlswriter.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-xlswriter.ini; \ + php -m | grep -q 'xlswriter'; \ + else \ + echo "PHP Extension for xlswriter is not supported for PHP 5.0"; \ + fi; \ fi