Added support for MS SQL server driver for PHP 7.0 - requested changes:

- removed cd / && \
- added INSTALL_MSSQL to docker-compose.yml and env-example
This commit is contained in:
Mark Hilton 2017-05-03 12:59:44 -04:00
parent 74ba0ef0a8
commit f339c3f055
3 changed files with 83 additions and 5 deletions

View File

@ -19,6 +19,7 @@ services:
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP} - INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
- INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO} - INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
- INSTALL_MSSQL=${WORKSPACE_INSTALL_MSSQL}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN} - INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH} - INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
@ -59,6 +60,7 @@ services:
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP} - INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP}
- INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO} - INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO}
- INSTALL_MSSQL=${PHP_FPM_INSTALL_MSSQL}
- INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE} - INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE}
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH} - INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
- INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS} - INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS}

View File

@ -32,6 +32,7 @@ PHP_INTERPRETER=php-fpm
WORKSPACE_INSTALL_XDEBUG=false WORKSPACE_INSTALL_XDEBUG=false
WORKSPACE_INSTALL_SOAP=false WORKSPACE_INSTALL_SOAP=false
WORKSPACE_INSTALL_MONGO=false WORKSPACE_INSTALL_MONGO=false
WORKSPACE_INSTALL_MSSQL=false
WORKSPACE_INSTALL_NODE=false WORKSPACE_INSTALL_NODE=false
WORKSPACE_INSTALL_YARN=false WORKSPACE_INSTALL_YARN=false
WORKSPACE_INSTALL_DRUSH=false WORKSPACE_INSTALL_DRUSH=false
@ -54,6 +55,7 @@ WORKSPACE_SSH_PORT=2222
PHP_FPM_INSTALL_XDEBUG=false PHP_FPM_INSTALL_XDEBUG=false
PHP_FPM_INSTALL_MONGO=false PHP_FPM_INSTALL_MONGO=false
PHP_FPM_INSTALL_MSSQL=false
PHP_FPM_INSTALL_SOAP=false PHP_FPM_INSTALL_SOAP=false
PHP_FPM_INSTALL_ZIP_ARCHIVE=false PHP_FPM_INSTALL_ZIP_ARCHIVE=false
PHP_FPM_INSTALL_BCMATH=false PHP_FPM_INSTALL_BCMATH=false
@ -239,4 +241,3 @@ PHP_IDE_CONFIG=serverName=laradock
# Fix for windows users to make sure the application path works. # Fix for windows users to make sure the application path works.
COMPOSE_CONVERT_WINDOWS_PATHS=1 COMPOSE_CONVERT_WINDOWS_PATHS=1

View File

@ -273,8 +273,8 @@ RUN if [ ${MSSQL} = true ]; then \
# extensions: # extensions:
##################################### #####################################
pecl install sqlsrv-4.0.6 && \ pecl install sqlsrv-4.1.7preview && \
pecl install pdo_sqlsrv-4.0.6 && \ pecl install pdo_sqlsrv-4.1.7preview && \
##################################### #####################################
# Set locales for the container # Set locales for the container
@ -292,8 +292,8 @@ RUN if [ ${MSSQL} = true ]; then \
ARG INSTALL_INTL=false ARG INSTALL_INTL=false
RUN if [ ${INSTALL_INTL} = true ]; then \ RUN if [ ${INSTALL_INTL} = true ]; then \
# Install intl and requirements # Install intl and requirements
apt-get -y update \ apt-get -y update && \
&& apt-get install -y zlib1g-dev libicu-dev g++ && \ apt-get install -y zlib1g-dev libicu-dev g++ && \
docker-php-ext-configure intl && \ docker-php-ext-configure intl && \
docker-php-ext-install intl \ docker-php-ext-install intl \
;fi ;fi
@ -312,6 +312,81 @@ RUN if [ ${INSTALL_GHOSTSCRIPT} = true ]; then \
ghostscript \ ghostscript \
;fi ;fi
#####################################
# SQL SERVER:
#####################################
ARG INSTALL_MSSQL=false
ENV INSTALL_MSSQL ${INSTALL_MSSQL}
RUN if [ ${INSTALL_MSSQL} = true ]; then \
#####################################
# Install Depenencies:
#####################################
apt-get update && \
apt-get install -y --force-yes wget apt-transport-https curl freetds-common libsybdb5 freetds-bin unixodbc unixodbc-dev && \
#####################################
# The following steps were taken from
# Microsoft's github account:
# https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways
#####################################
# Add PHP 7 repository
# for Debian jessie
# And System upgrade
echo "deb http://packages.dotdeb.org jessie all" \
| tee /etc/apt/sources.list.d/dotdeb.list \
&& wget -qO- https://www.dotdeb.org/dotdeb.gpg \
| apt-key add - \
&& apt-get update \
&& apt-get upgrade -qq && \
# Install UnixODBC
# Compile odbc_config as it is not part of unixodbc package
apt-get update && \
apt-get install -y whiptail \
unixodbc libgss3 odbcinst devscripts debhelper dh-exec dh-autoreconf libreadline-dev libltdl-dev \
&& dget -u -x http://http.debian.net/debian/pool/main/u/unixodbc/unixodbc_2.3.1-3.dsc \
&& cd unixodbc-*/ \
&& ./configure && make && make install \
&& cp -v ./exe/odbc_config /usr/local/bin/ && \
# Fake uname for install.sh
printf '#!/bin/bash\nif [ "$*" == "-p" ]; then echo "x86_64"; else /bin/uname "$@"; fi' \
| tee /usr/local/bin/uname \
&& chmod +x /usr/local/bin/uname && \
# Microsoft ODBC Driver 13 for Linux
# Note: There's a copy of this tar on my hubiC
wget -nv -O msodbcsql-13.0.0.0.tar.gz \
"https://meetsstorenew.blob.core.windows.net/contianerhd/Ubuntu%2013.0%20Tar/msodbcsql-13.0.0.0.tar.gz?st=2016-10-18T17%3A29%3A00Z&se=2022-10-19T17%3A29%3A00Z&sp=rl&sv=2015-04-05&sr=b&sig=cDwPfrouVeIQf0vi%2BnKt%2BzX8Z8caIYvRCmicDL5oknY%3D" \
&& tar -xf msodbcsql-13.0.0.0.tar.gz \
&& cd msodbcsql-*/ \
&& ldd lib64/libmsodbcsql-13.0.so.0.0 \
&& ./install.sh install --accept-license \
&& ls -l /opt/microsoft/msodbcsql/ \
&& odbcinst -q -d -n "ODBC Driver 13 for SQL Server" && \
#####################################
# Install sqlsrv y pdo_sqlsrv
# extensions:
#####################################
pecl install sqlsrv-4.1.7 && \
pecl install pdo_sqlsrv-4.1.7 && \
#####################################
# Set locales for the container
#####################################
apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen \
&& echo "extension=sqlsrv.so" > /etc/php/7.0/cli/conf.d/20-sqlsrv.ini \
&& echo "extension=pdo_sqlsrv.so" > /etc/php/7.0/cli/conf.d/20-pdo_sqlsrv.ini \
;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Final Touch # Final Touch