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