microsoft / msphpsql

Microsoft Drivers for PHP for SQL Server
MIT License
1.8k stars 371 forks source link

can't connect to database with sqlsrv #1464

Closed dimas-afprnm closed 1 month ago

dimas-afprnm commented 1 year ago

[ { "0": "08001", "1": -1, "2": "[Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol]", "SQLSTATE": "08001", "code": -1, "message": "[Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol]" }, { "0": "08001", "1": -1, "2": "[Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection", "SQLSTATE": "08001", "code": -1, "message": "[Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection" } ]

### Tasks
v-makouz commented 1 year ago

This looks to be the same issue as https://github.com/microsoft/msphpsql/issues/1462

v-makouz commented 1 month ago

This is not a PHP driver issue, but rather compatibility between OpenSSL and SQL Server. Starting with OpenSSL 3.0 TLSv1.0 and TLSv1.1 were deprecated and are not allowed by default, requiring at least TLSv1.2. Many older servers don't have TLSv1.2, thus the connection fails. The ideal solution is to patch or upgrade the server. If that's not possible, one can configure OpenSSL to still allow use of older protocols, but it's best to consult OpenSSL documentation or support for the most up to date instructions for how to do so.