From cffdc7588ed72ed8834f04955163a73a61916d27 Mon Sep 17 00:00:00 2001 From: Pavel Savushkin Date: Mon, 22 Mar 2021 21:34:34 +0200 Subject: [PATCH] feat(MSSQL extension): add MSSQL extension support MSSQL extension should be supported on the all available versions. --- .github/workflows/main-ci.yml | 1 - php-fpm/Dockerfile | 11 ++++++----- workspace/Dockerfile | 22 ++++++++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 8fae1b4f..0bb078da 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -33,7 +33,6 @@ jobs: sed -i -- 's/PHALCON=true/PHALCON=false/g' .env sed -i -- 's/RDKAFKA=true/RDKAFKA=false/g' .env sed -i -- 's/MAILPARSE=true/MAILPARSE=false/g' .env - sed -i -- 's/MSSQL=true/MSSQL=false/g' .env sed -i -- 's/MEMCACHED=true/MEMCACHED=false/g' .env sed -i -- 's/OCI8=true/OCI8=false/g' .env sed -i -- 's/IONCUBE=true/IONCUBE=false/g' .env diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 65d69651..6b9eaded 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -698,7 +698,7 @@ ARG INSTALL_MSSQL=false RUN set -eux; \ if [ ${INSTALL_MSSQL} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - apt-get -y install freetds-dev libsybdb5 \ + apt-get -yqq install freetds-dev libsybdb5 \ && ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \ && docker-php-ext-install mssql pdo_dblib \ && php -m | grep -q 'mssql' \ @@ -712,14 +712,15 @@ RUN set -eux; \ && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ && curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \ && apt-get update -yqq \ - # Install Dependencies && ACCEPT_EULA=Y apt-get install -yqq unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ - # link local aliases && ln -sfn /etc/locale.alias /usr/share/locale/locale.alias \ && locale-gen \ - # Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version. - && if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ + && if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "2" ]; then \ + pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 \ + ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \ + pecl install pdo_sqlsrv-5.6.1 sqlsrv-5.6.1 \ + ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 \ ;else \ pecl install pdo_sqlsrv sqlsrv \ diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 1da47888..4fe26f1e 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1040,7 +1040,7 @@ ARG INSTALL_MSSQL=false RUN set -eux; \ if [ ${INSTALL_MSSQL} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - apt-get -y install php5.6-sybase freetds-bin freetds-common libsybdb5 \ + apt-get install -yqq php5.6-sybase freetds-bin freetds-common libsybdb5 \ && php -m | grep -q 'mssql' \ && php -m | grep -q 'pdo_dblib' \ ;else \ @@ -1051,22 +1051,24 @@ RUN set -eux; \ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \ apt-get update -yqq && \ - ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools unixodbc unixodbc-dev libgss3 odbcinst locales && \ + ACCEPT_EULA=Y apt-get install -yqq msodbcsql17 mssql-tools unixodbc unixodbc-dev libgss3 odbcinst locales && \ ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd && \ ln -sfn /opt/mssql-tools/bin/bcp /usr/bin/bcp && \ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ locale-gen && \ - if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ - pecl install sqlsrv-5.3.0 pdo_sqlsrv-5.3.0 \ - ;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70100" ]; then \ - pecl install sqlsrv-5.6.1 pdo_sqlsrv-5.6.1 \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "2" ]; then \ + pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 \ + ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \ + pecl install pdo_sqlsrv-5.6.1 sqlsrv-5.6.1 \ + ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ + pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 \ ;else \ - pecl install sqlsrv pdo_sqlsrv \ + pecl install pdo_sqlsrv sqlsrv \ ;fi && \ echo "extension=sqlsrv.so" > /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-sqlsrv.ini && \ - echo "extension=pdo_sqlsrv.so" > /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-pdo_sqlsrv.ini \ - && php -m | grep -q 'sqlsrv' \ - && php -m | grep -q 'pdo_sqlsrv' \ + echo "extension=pdo_sqlsrv.so" > /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-pdo_sqlsrv.ini && \ + php -m | grep -q 'sqlsrv' && \ + php -m | grep -q 'pdo_sqlsrv' \ ;fi \ ;fi