Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL SERVER client support failed for debian 11 based OS image (PHP-FPM) #3149

Closed
justinchen19791203 opened this issue Feb 14, 2022 · 2 comments

Comments

@justinchen19791203
Copy link

Description:

E: Unable to locate package msodbcsql17

Expected Behavior:

The package should be installed successfully

Context information:

Output of git rev-parse HEAD

f2f34afb01711d9e95ac7c9817f7907063da6924

Output of docker version

Client:
 Cloud integration: v1.0.22
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:44:07 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker-compose version

Docker Compose version v2.2.3

System info: Mac, Windows or Linux. Include which disto/version

Windows  10

Steps to reproduce the issue:

FROM laradock/php-fpm:latest-8.1

ARG INSTALL_MSSQL=true

RUN set -eux;
if [ ${INSTALL_MSSQL} = true ]; then
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then
apt-get -yqq install freetds-dev libsybdb5
&& ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so
&& docker-php-ext-install mssql pdo_dblib
&& php -m | grep -oiE '^mssql$'
&& php -m | grep -oiE '^pdo_dblib$'
;else
###########################################################################
# Ref from https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-adding-pdo_sqlsrv-and-sqlsrv-to-official-php-image
###########################################################################
# Add Microsoft repo for Microsoft ODBC Driver 13 for Linux
apt-get install -yqq apt-transport-https gnupg lsb-release
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
&& curl https://packages.microsoft.com/config/debian/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
&& apt-get update -yqq
&& ACCEPT_EULA=Y apt-get install -yqq unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
&& ln -sfn /etc/locale.alias /usr/share/locale/locale.alias
&& locale-gen
&& if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then
pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0
;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70100" ]; then
pecl install pdo_sqlsrv-5.6.1 sqlsrv-5.6.1
;elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70200" ]; then
pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1
;else
pecl install pdo_sqlsrv sqlsrv
;fi
&& docker-php-ext-enable pdo_sqlsrv sqlsrv
&& php -m | grep -oiE '^pdo_sqlsrv$'
&& php -m | grep -oiE '^sqlsrv$'
;fi
;fi

Stacktrace & Additional info:

I think it is because of the difference of support between two debbian versions by microsoft.
Is there any solution to this issue?

https://packages.microsoft.com/debian/10/prod/pool/main/m/

https://packages.microsoft.com/debian/11/prod/pool/main/m/

@justinchen19791203 justinchen19791203 changed the title SQL SERVER client support failed for debian 11 based OS image SQL SERVER client support failed for debian 11 based OS image (PHP-FPM) Feb 14, 2022
@duchymor
Copy link
Contributor

possible duplicate of #3042

@duchymor
Copy link
Contributor

duchymor commented Mar 15, 2022

@justinchen19791203 would you try to build now? Seems to be autofixed by recent Microsoft release https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
In my fork both 7.4 and 8.0 build ok, but I can't test 8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants