php5 support MSSQL extension
This commit is contained in:
parent
66c61d9a72
commit
e8eb97b398
|
@ -373,23 +373,31 @@ RUN if [ ${INSTALL_LDAP} = true ]; then \
|
|||
ARG INSTALL_MSSQL=false
|
||||
|
||||
RUN set -eux; if [ ${INSTALL_MSSQL} = true ]; then \
|
||||
###########################################################################
|
||||
# Ref from https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-adding-pdo_sqlsrv-and-sqlsrv-to-official-php-image
|
||||
###########################################################################
|
||||
# Add Microsoft repo for Microsoft ODBC Driver 13 for Linux
|
||||
apt-get install -y apt-transport-https gnupg \
|
||||
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
|
||||
&& curl https://packages.microsoft.com/config/debian/8/prod.list > /etc/apt/sources.list.d/mssql-release.list \
|
||||
&& apt-get update -yqq \
|
||||
# Install Dependencies
|
||||
&& ACCEPT_EULA=Y apt-get install -y unixodbc unixodbc-dev libgss3 odbcinst msodbcsql locales \
|
||||
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
|
||||
&& locale-gen \
|
||||
# Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version.
|
||||
&& pecl install pdo_sqlsrv-4.1.8preview sqlsrv-4.1.8preview \
|
||||
&& docker-php-ext-enable pdo_sqlsrv sqlsrv \
|
||||
&& php -m | grep -q 'pdo_sqlsrv' \
|
||||
&& php -m | grep -q 'sqlsrv' \
|
||||
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
|
||||
apt-get -y 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' \
|
||||
&& php -m | grep -q 'pdo_dblib' \
|
||||
;else \
|
||||
###########################################################################
|
||||
# Ref from https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-adding-pdo_sqlsrv-and-sqlsrv-to-official-php-image
|
||||
###########################################################################
|
||||
# Add Microsoft repo for Microsoft ODBC Driver 13 for Linux
|
||||
apt-get install -y apt-transport-https gnupg \
|
||||
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
|
||||
&& curl https://packages.microsoft.com/config/debian/8/prod.list > /etc/apt/sources.list.d/mssql-release.list \
|
||||
&& apt-get update -yqq \
|
||||
# Install Dependencies
|
||||
&& ACCEPT_EULA=Y apt-get install -y unixodbc unixodbc-dev libgss3 odbcinst msodbcsql locales \
|
||||
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
|
||||
&& locale-gen \
|
||||
# Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version.
|
||||
&& pecl install pdo_sqlsrv-4.1.8preview sqlsrv-4.1.8preview \
|
||||
&& docker-php-ext-enable pdo_sqlsrv sqlsrv \
|
||||
&& php -m | grep -q 'pdo_sqlsrv' \
|
||||
&& php -m | grep -q 'sqlsrv' \
|
||||
;fi \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
|
|
|
@ -577,34 +577,40 @@ ARG INSTALL_MSSQL=false
|
|||
ARG PHP_VERSION=${PHP_VERSION}
|
||||
|
||||
RUN set -eux; if [ ${INSTALL_MSSQL} = true ]; then \
|
||||
###########################################################################
|
||||
# The following steps were taken from
|
||||
# https://github.com/Microsoft/msphpsql/wiki/Install-and-configuration
|
||||
###########################################################################
|
||||
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 -yqq msodbcsql=13.0.1.0-1 mssql-tools=14.0.2.0-1 && \
|
||||
apt-get install -yqq unixodbc-dev-utf16 && \
|
||||
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd && \
|
||||
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp && \
|
||||
ACCEPT_EULA=Y apt-get install -yqq \
|
||||
unixodbc \
|
||||
unixodbc-dev \
|
||||
libgss3 \
|
||||
odbcinst \
|
||||
msodbcsql \
|
||||
locales && \
|
||||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
||||
locale-gen && \
|
||||
pecl install sqlsrv-4.3.0 pdo_sqlsrv-4.3.0 && \
|
||||
apt-get install -y locales && \
|
||||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
||||
locale-gen && \
|
||||
echo "extension=sqlsrv.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-sqlsrv.ini && \
|
||||
echo "extension=pdo_sqlsrv.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-pdo_sqlsrv.ini \
|
||||
&& php -m | grep -q 'sqlsrv' \
|
||||
&& php -m | grep -q 'pdo_sqlsrv' \
|
||||
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
|
||||
apt-get -y install php5.6-sybase freetds-bin freetds-common libsybdb5 \
|
||||
&& php -m | grep -q 'mssql' \
|
||||
&& php -m | grep -q 'pdo_dblib' \
|
||||
;else \
|
||||
###########################################################################
|
||||
# The following steps were taken from
|
||||
# https://github.com/Microsoft/msphpsql/wiki/Install-and-configuration
|
||||
###########################################################################
|
||||
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 -yqq msodbcsql=13.0.1.0-1 mssql-tools=14.0.2.0-1 && \
|
||||
apt-get install -yqq unixodbc-dev-utf16 && \
|
||||
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd && \
|
||||
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp && \
|
||||
ACCEPT_EULA=Y apt-get install -yqq \
|
||||
unixodbc \
|
||||
unixodbc-dev \
|
||||
libgss3 \
|
||||
odbcinst \
|
||||
msodbcsql \
|
||||
locales && \
|
||||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
||||
locale-gen && \
|
||||
pecl install sqlsrv-4.3.0 pdo_sqlsrv-4.3.0 && \
|
||||
apt-get install -y locales && \
|
||||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
||||
locale-gen && \
|
||||
echo "extension=sqlsrv.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-sqlsrv.ini && \
|
||||
echo "extension=pdo_sqlsrv.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-pdo_sqlsrv.ini \
|
||||
&& php -m | grep -q 'sqlsrv' \
|
||||
&& php -m | grep -q 'pdo_sqlsrv' \
|
||||
;fi \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
|
|
Loading…
Reference in New Issue