I am getting this error when I try to connect to the sqlserver db:
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension
requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC
Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712 [message] => This
extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the
ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712 ) )
My Dockerfile below:
FROM microsoft/mssql-tools as mssql
FROM php:7.2-fpm-alpine
COPY --from=mssql /opt/microsoft/ /opt/microsoft/
COPY --from=mssql /opt/mssql-tools/ /opt/mssql-tools/
COPY --from=mssql /usr/lib/libmsodbcsql-13.so /usr/lib/libmsodbcsql-13.so
RUN apk update
&& apk add --no-cache git mysql-client curl libmcrypt libmcrypt-dev openssh-client icu-dev
unixodbc-dev
libxml2-dev freetype-dev libpng-dev libjpeg-turbo-dev g++ make autoconf
&& docker-php-source extract
&& pecl install xdebug redis
&& docker-php-ext-enable xdebug redis
&& docker-php-source delete
&& docker-php-ext-install pdo_mysql soap intl zip
&& pecl install
sqlsrv
pdo_sqlsrv
&& docker-php-ext-enable --ini-name 30-sqlsrv.ini sqlsrv
&& docker-php-ext-enable --ini-name 35-pdo_sqlsrv.ini pdo_sqlsrv
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
&& echo "xdebug.remote_port=10000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
&& echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
&& echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
&& rm -rf /tmp/*
CMD ["php-fpm", "-F"]
WORKDIR /var/www/cssp
EXPOSE 9000
It seems there is a problem with the installation of the driver
Has anyone tried this before? Please share. Thank you.
2
Answers
Try with below DockerFile
If you’re stuck with php 7.1 like I do now, here is the updated Dockerfile: