当前位置:   article > 正文

SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]_[microsoft][odbc driver 17 for sql server]ssl prov

[microsoft][odbc driver 17 for sql server]ssl provider: [openssl library cou

PHP通过sqlsrv去连接SQLServer报错:

[Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]

  1. [
  2. {
  3. "0": "08001",
  4. "SQLSTATE": "08001",
  5. "1": -1,
  6. "code": -1,
  7. "2": "[Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]",
  8. "message": "[Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]"
  9. },
  10. {
  11. "0": "08001",
  12. "SQLSTATE": "08001",
  13. "1": -1,
  14. "code": -1,
  15. "2": "[Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection",
  16. "message": "[Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection"
  17. }
  18. ]

报错原因 

意思是 ODBC Driver 17 需要 OpenSSL 1.0 or 1.1版本,可能是你没有安装或者安装了其他版本的 openssl 可以通过如下命令查看版本:

openssl version

解决办法:

如果你是3.0版本,建议用ODBC Driver 18来连接,先安装 ODBC Driver 18

方法1: 使用 ODBC Driver 18 (推荐)

  1. ## 先查询 odbcinst.ini 配置文件路径
  2. find / -name 'odbcinst.ini'
  3. ## 再修改配置,比如我的路径
  4. vim /usr/local/etc/odbcinst.ini

把ODBC Driver 17 的配置删掉或注释掉,保存退出生效。

  1. #[ODBC Driver 17 for SQL Server]
  2. #Description=Microsoft ODBC Driver 17 for SQL Server
  3. #Driver=/usr/local/lib/libmsodbcsql.17.dylib
  4. #UsageCount=5
  5. [ODBC Driver 18 for SQL Server]
  6. Description=Microsoft ODBC Driver 18 for SQL Server
  7. Driver=/usr/local/lib/libmsodbcsql.18.dylib
  8. UsageCount=3

方法2: 修改openssl版本

此方法慎用,可能其他软件有依赖这个插件,这里我不写具体的方法了,已经被坑过了。

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号