Merge pull request #2916 from PavelSavushkinMix/fix/mssql_extension

feat(MSSQL extension): add MSSQL extension support
This commit is contained in:
Shao Yu-Lung (Allen) 2021-03-23 08:41:07 +08:00 committed by GitHub
commit c3d90c7b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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/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

View File

@ -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 \

View File

@ -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