mlocati/docker-php-extension-installer

missing dependency for pdo_sqlsrv

Closed this issue · 1 comments

Version of install-php-extensions

2.1.66

Error description

pdo_sqlsrv require ms odbc drive to be installed.
Once you try to connect
Connection failed: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712
So the installation process should install the driver as well.

At time of writing there are 2 releases of the driver

5.10.1 which is for php 7.4 (support php 8 as well)
https://github.com/Microsoft/msphpsql/releases/v5.10.1

5.11.1 which support php 8.x
https://github.com/Microsoft/msphpsql/releases/v5.11.1

There are packages for some distribution and source as well.

In alternative freetds should work, but not 100% sure since I switched to pdo because freetds via odbc was saying that does not support parameter binding in the equery

Docker image

php:7.4

Minimal Dockerfile

FROM php:7.4-fpm
SHELL ["/bin/bash", "-ec"]
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions
RUN install-php-extensions intl ldap odbc soap iconv mysqli apcu opcache @composer xdebug gd zip pdo_sqlsrv

My bad, I missed it got installed, sorry