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

Can not install mssql extension on php-fpm #3042

Closed
dinhchuong7913 opened this issue Aug 25, 2021 · 17 comments
Closed

Can not install mssql extension on php-fpm #3042

dinhchuong7913 opened this issue Aug 25, 2021 · 17 comments

Comments

@dinhchuong7913
Copy link

dinhchuong7913 commented Aug 25, 2021

Description:

After change config
PHP_FPM_INSTALL_MSSQL=true
WORKSPACE_INSTALL_MSSQL=true
I run build php by running command docker compose build php-fpm

I get the error

 => ERROR [laradock_php-fpm 42/76] RUN set -eux;   if [ true = true ]; then     if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then       apt-get -yqq install freetds-dev libsybdb5       && ln -s /u  6.3s
------
 > [laradock_php-fpm 42/76] RUN set -eux;   if [ true = 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       && doc

failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c 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 -q 'mssql' && php -m | grep -q 'pdo_dblib' ;else apt-get install -yqq apt-transport-https gnupg && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && curl https://packages.microsoft.com/config/debian/9/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_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "2" ]; then pecl install pdo_sqlsrv-5.8.1 sqlsrv-5.8.1 ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then pecl install pdo_sqlsrv-5.6.1 sqlsrv-5.6.1 ;elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 ;else pecl install pdo_sqlsrv sqlsrv ;fi && docker-php-ext-enable pdo_sqlsrv sqlsrv && php -m | grep -q 'pdo_sqlsrv' && php -m | grep -q 'sqlsrv' ;fi ;fi]: exit code: 100

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

Please help me

@bestlong bestlong added the PHP Extension: sqlsrv / dblib (MSSQL) Microsoft SQL Server Functions label Aug 26, 2021
@GautierDele
Copy link
Contributor

I also have a problem since yersterday with MSSQL.
To be more clear about this, this is the error:
Unable to correct problems, you have held broken packages
It's caused when installing packets:
apt-get install -yqq unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales
it seems like something has changed with microsoft

@GautierDele
Copy link
Contributor

@bestlong thanks for workspace fix, will see what I can do on php-fpm

@GautierDele
Copy link
Contributor

GautierDele commented Aug 30, 2021

It seems like i'm not able to install mssql odbc drivers on debian ... Will investigate more

It seems like the problem is coming from debian 11 released recently. Maybe we should try to stay on debian 10 for now ?

@bestlong
Copy link
Member

Hi @GautierDele

php-fpm image now base on Debian 11 (bullseye).

unfortunately Microsoft ODBC 17 not support it.

Maybe I will locked php-fpm base image on Debian 10 (buster) or change into FreeTDS.

@typebrad
Copy link

I have pulled all changes and also experiencing the same issue as OP @dinhchuong7913

@GautierDele
Copy link
Contributor

Hi @bestlong,

Yeah maybe waiting a bit for packages to release could be a good idea,

For now, all users can use a former image from php-fpm / workspace.

Did you have time to look at my PR ?
Could be great since I need SMB in my project 😄

Thanks

@arthr
Copy link

arthr commented Sep 1, 2021

How can i solve that problem with laradock/php-fpm msodbcsql17 install?

@joe-niland
Copy link
Contributor

I agree with @GautierDele - should hardcode to Debian 10 for now.

@arthr you can try changing the base image to use the php-buster variant.

@wdarking
Copy link

wdarking commented Sep 6, 2021

What is the base image you are using for php? I believe images will default to bullseye (debian 11) now instead of buster (debian 10)

So for example, you'll want to use the php:8.0-fpm-buster image instead of php8.0-fpm, until packages exist for bullseye.

https://github.com/MicrosoftDocs/sql-docs/issues/6494#issuecomment-907890630

@wdarking
Copy link

wdarking commented Sep 6, 2021

Temp workaround:

1 - Comment the line 17 from the file https://github.com/laradock/laradock/blob/master/php-fpm/Dockerfile on your installation of laradock, and paste this:

FROM laradock/php-fpm:buster-7.4

2 - Create a file Dockerfile-7.4 inside the folder laradock/php-fpm with the contents of this file: https://raw.githubusercontent.com/laradock/php-fpm/master/Dockerfile-7.4 then change the line 7 from:

FROM php:7.4-fpm to FROM php:7.4-fpm-buster

3 - Inside the laradock directory, rebuild the php-fpm image with this command:

docker build -f php-fpm/Dockerfile-7.4 . -t laradock/php-fpm:buster-7.4

then

docker-compose build php-fpm

It should build without errors. Now you can start up your containers, with

docker-compose up -d nginx mssql workspace

It worked for me. I hope it works for you as well.

@banpar
Copy link

banpar commented Sep 10, 2021

Temp workaround:

1 - Comment the line 17 from the file https://github.com/laradock/laradock/blob/master/php-fpm/Dockerfile on your installation of laradock, and paste this:

FROM laradock/php-fpm:buster-7.4

2 - Create a file Dockerfile-7.4 inside the folder laradock/php-fpm with the contents of this file: https://raw.githubusercontent.com/laradock/php-fpm/master/Dockerfile-7.4 then change the line 7 from:

FROM php:7.4-fpm to FROM php:7.4-fpm-buster

3 - Inside the laradock directory, rebuild the php-fpm image with this command:

docker build -f php-fpm/Dockerfile-7.4 . -t laradock/php-fpm:buster-7.4

then

docker-compose build php-fpm

It should build without errors. Now you can start up your containers, with

docker-compose up -d nginx mssql workspace

It worked for me. I hope it works for you as well.

When i try to run the second step i got this error:
ERROR [internal] load metadata from docker.io/laradock/php-fpm:buster-7.4

and then build fail.

@duchymor
Copy link
Contributor

PHP_FPM_BASE_IMAGE_TAG_PREFIX=20210814

@arthr
Copy link

arthr commented Oct 5, 2021

PHP_FPM_BASE_IMAGE_TAG_PREFIX=20210814

Thx for the help! <3

@stale
Copy link

stale bot commented Jan 3, 2022

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Jan 3, 2022
denis-chmel added a commit to DH-Enterprise/laradock that referenced this issue Jan 9, 2022
…is workspace elasticsearch php-worker php-fpm mongo

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to parse stage name "laradock/php-fpm:20210814 # laradock#3042 (comment)": invalid reference format
@stale
Copy link

stale bot commented Feb 20, 2022

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 20, 2022
@duchymor
Copy link
Contributor

It seems Microsoft finally released an update https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15, just need to check if the issue healed itselfs...

@MiguelAngelVM
Copy link

MiguelAngelVM commented Mar 24, 2023

I couldn't fix it with this
#3042 (comment)

Does anyone have another solution?

My error

+ pecl install pdo_sqlsrv sqlsrv
pecl/pdo_sqlsrv requires PHP (version >= 8.0.0), installed version is 7.4.33
pecl/sqlsrv requires PHP (version >= 8.0.0), installed version is 7.4.33
No valid packages found

UPDATE:
Downgrade php version from 7.4 to 7.2 and it works correctly

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

10 participants