Last active
March 24, 2021 18:38
-
-
Save danielnv18/c6768295f2e8b9796e311349df97aa32 to your computer and use it in GitHub Desktop.
Docker with php 7.0 with unixodbc, Microsoft ODBC Driver 13 for Linux and pdo_sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.0.10-fpm | |
MAINTAINER Daniel Noyola <[email protected]> | |
# install the PHP extensions we need | |
RUN apt-get update && apt-get install -y locales unixodbc libgss3 odbcinst devscripts debhelper dh-exec dh-autoreconf libreadline-dev libltdl-dev unixodbc-dev wget unzip \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& docker-php-ext-install pdo \ | |
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen | |
RUN yes | pecl install xdebug \ | |
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ | |
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ | |
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini | |
# Compile odbc_config | |
RUN cd /usr/local/src/ && dget -ux http://http.debian.net/debian/pool/main/u/unixodbc/unixodbc_2.3.1-3.dsc \ | |
&& cd unixodbc-2.3.1/ && apt-get update && dpkg-buildpackage -uc -d -us -B && cp ./exe/odbc_config /usr/local/bin/ | |
## Microsoft ODBC Driver 13 for Linux | |
RUN cd /usr/local/src/ \ | |
&& wget https://download.microsoft.com/download/2/E/5/2E58F097-805C-4AB8-9FC6-71288AB4409D/msodbcsql-13.0.0.0.tar.gz \ | |
&& tar xf msodbcsql-13.0.0.0.tar.gz && cd msodbcsql-13.0.0.0/ \ | |
&& ldd lib64/libmsodbcsql-13.0.so.0.0; echo "RET=$?" \ | |
&& sed -i 's/$(uname -p)/"x86_64"/g' ./install.sh \ | |
&& ./install.sh install --force --accept-license | |
# Install PHP extensions for SQL Server | |
RUN cd /tmp && wget https://github.com/Microsoft/msphpsql/releases/download/v4.0.5-Linux/Ubuntu15.zip \ | |
&& unzip Ubuntu15.zip \ | |
&& mv -v Ubuntu15/* /usr/local/lib/php/extensions/no-debug-non-zts-20151012/ \ | |
&& rm /usr/local/lib/php/extensions/no-debug-non-zts-20151012/signature \ | |
&& rm -rf /tmp/* | |
RUN echo "extension=php_sqlsrv_7_nts.so" >> /usr/local/etc/php/conf.d/sqlsvr.ini \ | |
&& echo "extension=php_pdo_sqlsrv_7_nts.so" >> /usr/local/etc/php/conf.d/sqlsvr.ini \ | |
&& locale-gen | |
CMD ["php-fpm", "-F"] | |
EXPOSE 9000 |
I'm going to leave this gist as reference but there is an updated version https://gist.github.com/danielnv18/7e1c680bfd1fc48e4c2cc5a180dff1b7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lellky, to avoid an error you'll need the "-y" flag