feat(MSSQL extension): add MSSQL extension support

MSSQL extension should be supported on the all available versions.
This commit is contained in:
Pavel Savushkin 2021-03-22 21:34:34 +02:00
parent 4ebcc84955
commit cffdc7588e
No known key found for this signature in database
GPG Key ID: BD2EDA3E125300DD
3 changed files with 18 additions and 16 deletions

View File

@ -33,7 +33,6 @@ jobs:
sed -i -- 's/PHALCON=true/PHALCON=false/g' .env sed -i -- 's/PHALCON=true/PHALCON=false/g' .env
sed -i -- 's/RDKAFKA=true/RDKAFKA=false/g' .env sed -i -- 's/RDKAFKA=true/RDKAFKA=false/g' .env
sed -i -- 's/MAILPARSE=true/MAILPARSE=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/MEMCACHED=true/MEMCACHED=false/g' .env
sed -i -- 's/OCI8=true/OCI8=false/g' .env sed -i -- 's/OCI8=true/OCI8=false/g' .env
sed -i -- 's/IONCUBE=true/IONCUBE=false/g' .env sed -i -- 's/IONCUBE=true/IONCUBE=false/g' .env

View File

@ -698,7 +698,7 @@ ARG INSTALL_MSSQL=false
RUN set -eux; \ RUN set -eux; \
if [ ${INSTALL_MSSQL} = true ]; then \ if [ ${INSTALL_MSSQL} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; 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 \ && ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \
&& docker-php-ext-install mssql pdo_dblib \ && docker-php-ext-install mssql pdo_dblib \
&& php -m | grep -q 'mssql' \ && 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/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \ && curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update -yqq \ && apt-get update -yqq \
# Install Dependencies
&& ACCEPT_EULA=Y apt-get install -yqq unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \ && ACCEPT_EULA=Y apt-get install -yqq unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
# link local aliases
&& ln -sfn /etc/locale.alias /usr/share/locale/locale.alias \ && ln -sfn /etc/locale.alias /usr/share/locale/locale.alias \
&& locale-gen \ && locale-gen \
# Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version. && if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "2" ]; then \
&& if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; 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 \ pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 \
;else \ ;else \
pecl install pdo_sqlsrv sqlsrv \ pecl install pdo_sqlsrv sqlsrv \

View File

@ -1040,7 +1040,7 @@ ARG INSTALL_MSSQL=false
RUN set -eux; \ RUN set -eux; \
if [ ${INSTALL_MSSQL} = true ]; then \ if [ ${INSTALL_MSSQL} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; 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 'mssql' \
&& php -m | grep -q 'pdo_dblib' \ && php -m | grep -q 'pdo_dblib' \
;else \ ;else \
@ -1051,22 +1051,24 @@ RUN set -eux; \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ 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 && \ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update -yqq && \ 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/sqlcmd /usr/bin/sqlcmd && \
ln -sfn /opt/mssql-tools/bin/bcp /usr/bin/bcp && \ ln -sfn /opt/mssql-tools/bin/bcp /usr/bin/bcp && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen && \ locale-gen && \
if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "2" ]; then \
pecl install sqlsrv-5.3.0 pdo_sqlsrv-5.3.0 \ pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 \
;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70100" ]; then \ ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \
pecl install sqlsrv-5.6.1 pdo_sqlsrv-5.6.1 \ 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 \ ;else \
pecl install sqlsrv pdo_sqlsrv \ pecl install pdo_sqlsrv sqlsrv \
;fi && \ ;fi && \
echo "extension=sqlsrv.so" > /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-sqlsrv.ini && \ 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 \ 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 'sqlsrv' && \
&& php -m | grep -q 'pdo_sqlsrv' \ php -m | grep -q 'pdo_sqlsrv' \
;fi \ ;fi \
;fi ;fi