问题
Folks, I have installed the msodbcsql package at least several dozen times. Never had this issue come up. Even spent the entire day yesterday trying to fix this.
Step 1: add the apt key and repo to sourced.list.d Step 2: apt-get install the msodbcsql17, mssql-tools, php odbc_pdo extensions, etc Step 3: create a very basic test.php that (on all other existing older servers WORKS) makes a test connection to my mssql db.
Fails with:
SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1' : file not found
Yes, the file exists.
I have tried chmod 755 to the file, still says it does not exist.
I have done a ldd against the file, here is the output:
linux-vdso.so.1 (0x00007ffe13bf8000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc1e865a000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc1e8452000)
libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007fc1e823d000)
libcrypto.so.1.0.2 => not found
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007fc1e7f67000)
libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007fc1e7d1c000)
libssl.so.1.0.2 => not found
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fc1e7b15000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc1e778c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc1e73ee000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc1e71d6000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc1e6fb7000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc1e6bc6000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc1e8c65000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fc1e69bc000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007fc1e678a000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fc1e6586000)
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fc1e637b000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007fc1e6177000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fc1e5f5c000)
Two libraries seem to be missing. I found I have libssl1.1 and 1.0.0. I have tried creating symlinks to BOTH the 1.1 and 1.0.0 versions of the libssl shared objects. Still get the same error.
Again, YES - I have copied/pasted the exact path the error screams about. The path is correct.
I have tried using isql command line as well - same exact error. So this is certainly something with the odbc<->msodbcsql library. This is NOT specific to the PHP/PDO/ODBC stuff.
Interestingly, the mssql-cli command line tool (from the Microsoft repo) DOES work. Running ldd against it says it is NOT a dynamic executable.
Installed versions of all libraries involved:
unixodbc = 2.3.7
libodbc1 = 2.3.7
odbcinst = 2.3.7
msodbcsql = 17.3.1.1-1
All versions are the latest available from Microsoft repo. All under Ubuntu 18.04. I just re-tried the procedure (I have done countless times) on my laptop - same result. Complaining that the driver library is not found.
Output of odbcinst -j is as follows:
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
Yes, the files exist at /etc/odbcinst.ini and /etc/odb.ini.
Contents of /etc/odbcinst.ini:
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1
UsageCount=1
Running "stat /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1":
Size: 2046672 Blocks: 4000 IO Block: 4096 regular file
I have found very little info regarding this issue. The few posts I have came across either did NOT solve the issue, or have NOT been answered.
So.. am I missing something here? Or should I file a bug report?
On a side note, I have had nothing but issues with Ubuntu 18.04 and the msodbc stuff since day one. Originally, there was the libcurl3/4 issue. I suppose that has been fixed now. But seems this may be... a bug?
回答1:
I ran into the exact same problem today. apt-get -y install libssl1.0.0
solved the problem in my case.
来源:https://stackoverflow.com/questions/55126811/ubuntu-18-04-and-msodbcsql17-cant-open-lib-should-i-file-a-bug-report