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

Error loading sqlsrv.so and pdo_sqlsrv.so #1

Open
lucasctd opened this issue Feb 4, 2019 · 4 comments
Open

Error loading sqlsrv.so and pdo_sqlsrv.so #1

lucasctd opened this issue Feb 4, 2019 · 4 comments

Comments

@lucasctd
Copy link

lucasctd commented Feb 4, 2019

It's not working :v
image

I've tried all available versions of FPM.

@ghost
Copy link

ghost commented May 8, 2019

Second that

/var/www/html # php -m | grep mssql

PHP Warning:  PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/sqlsrv.so (Error loading shared library libstdc++.so.6: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20170718/sqlsrv.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/sqlsrv.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20170718/sqlsrv.so.so: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_sqlsrv.so (Error loading shared library libstdc++.so.6: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_sqlsrv.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_sqlsrv.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_sqlsrv.so.so: No such file or directory)) in Unknown on line 0

What I did is to add libstdc++ to persistent dependencies

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 set -xe \
    && apk add --no-cache --virtual .persistent-deps \
        freetds \
        unixodbc \
        libstdc++ \
    && apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        unixodbc-dev \
        freetds-dev \
    && docker-php-source extract \
    && docker-php-ext-install pdo_dblib \
    && 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 \
    && docker-php-source delete \
    && apk del .build-deps

@lucasctd
Copy link
Author

lucasctd commented May 8, 2019

hmmm cool.
I've created my own: https://hub.docker.com/r/lucasctd/php-mssql

@lucasctd
Copy link
Author

lucasctd commented May 8, 2019

I haven't tested that, but if you say it works, I will close this issue then.

@lucasctd lucasctd closed this as completed May 8, 2019
@lucasctd lucasctd reopened this May 12, 2019
@lucasctd
Copy link
Author

@arnoldasbet It does not work. MS ODBC driver is not available for alpine as stated here.

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

No branches or pull requests

1 participant