msphpsql icon indicating copy to clipboard operation
msphpsql copied to clipboard

Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1' : file not found

Open agentGreg opened this issue 7 years ago • 6 comments

PHP Driver version or file name

Microsoft ODBC Driver 17 for SQL Server, sqlsrv-5.6.1

Client operating system

Ubuntu 16.04

PHP version

7.3

Problem description

I've installed drivers using PECL (pecl install pdo_sqlsrv sqlsrv), while trying to:

sqlcmd -S <server_ip> -U <user_name> -P <pass>
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1' : file not found.

The same error when I try to access the server through PHP. The file exists and is accessible by all:

ls -al /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1
-rwxr-xr-x 1 root root 2046672 Feb 12 21:08 /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1

All library dependencies are met:

ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1
    linux-vdso.so.1 =>  (0x00007ffd0c14b000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4fd9349000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4fd9141000)
    libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f4fd8f26000)
    libcrypto.so.1.0.2 => not found
    libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f4fd8c54000)
    libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f4fd8a0a000)
    libssl.so.1.0.2 => not found
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f4fd8805000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4fd8422000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4fd8119000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4fd7f01000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4fd7ce4000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4fd791a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4fd9954000)
    libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f4fd76eb000)
    libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f4fd74e7000)
    libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f4fd72dc000)
    libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f4fd70d8000)
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f4fd6ebd000)

agentGreg avatar Jun 13 '19 14:06 agentGreg

HI @matfiz, how did you install ODBC and/or mssql tools? Did you follow the instructions on the documentation?

Maybe you can try to uninstall them first? Can you reproduce the same problem in a clean Ubuntu 16.04?

yitam avatar Jun 13 '19 19:06 yitam

Thank's for an answer, @yitam. I have uninstalled all MS-ODBC related packages and installed them again and it actually helped. I'm closing the issue.

agentGreg avatar Jun 14 '19 13:06 agentGreg

I have the same issue, but I use docker container and everything is installed from scratch. The issue started when I rebuilt docker container, looks like php:7.2-fpm changed from debian stretch to buster, maybe that's the issue.

vedmant avatar Jul 15 '19 08:07 vedmant

Thanks @vedmant for the info. You might need to move back to debian stretch or wait for the next release of ODBC driver. Please stay tuned.

yitam avatar Jul 15 '19 20:07 yitam

Verified that this is due to php:php-fpm moving to 'buster'. In the meantime you can for example use php:7.3-fpm-stretch and it should work as before.

piotrgulbis avatar Jul 16 '19 09:07 piotrgulbis

FYI, ODBC driver 17.4 is released with instructions updated

yitam avatar Aug 07 '19 18:08 yitam