microsoft / msphpsql

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

SQL server connection #1509

Open RameshSubramaniL opened 2 months ago

RameshSubramaniL commented 2 months ago

Microsoft ODBC Driver 17 for SQL Server : SSL Provider: [error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol]. Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.

i get this ODBC driver error when i try to connect sql server ,i tried update version of ODBC and then below code changes

[default_conf] ssl_conf = ssl_sect

[ssl_sect] system_default = system_default_sect

[system_default_sect] MinProtocol = TLSv1.2 CipherString = DEFAULT@SECLEVEL=1

i get same error whatever i change ,any solution for fix this error?

v-makouz commented 2 months ago

You can try setting MinProtocol to TLSv1.0 and CipherString to DEFAULT@SECLEVEL=0, but the best approach is to patch the server to support TLS 1.2

d4em0nsp4wn commented 2 months ago

I am having a similar issue, sqlcmd, isql, and even setting up the connection in PHP using "new PDO('odbc:Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.3.so.3.1;...connection string here);" works....but sqlsrv_connect fails with "Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server." code 26, sqlstate 08001; code 10054, [Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x2746. A tcp dump shows proper TLSv1.2 handling with all tools mentioned above, however, a tcp dump with sqlsrv_connect shows only 8 packets before the connection is interrupted. The PHP environment is PHP 8.0.30. The same occurs regardless of using PHP 7.4 to 8.3. Also worth nothing the TCP dump shows the source and destination ports to be the same for every packet, whereas PDO, isql, and sqlcmd all have a randomized starting port. The sql instance is using a custom tcp port. The sql server requires TLS 1.2, and is SQL Server 2016.

v-makouz commented 1 month ago

Which operating system is this one?

d4em0nsp4wn commented 1 month ago

Which operating system is this one?

Cloudlinux/AlmaLinux 8. 64bit.

v-makouz commented 1 month ago

Does it give the same error when using only ODBC (isql, sqlcmd)? Or is it specific to PHP driver?

d4em0nsp4wn commented 1 month ago

Does it give the same error when using only ODBC (isql, sqlcmd)? Or is it specific to PHP driver?

The error is only specific when using the sqlsrv.so native module within PHP, isql, sqlcmd, and $pd = new PDO('odbc:Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.3.so.3.1;SERVER= dsn works just fine within PHP, but we are unable to use the PDO driver in this manner as the odbc function to permit multiple active results sets does not appear to work within PDO. We specified both version 18 and version 17 and got the same errors out of the msphpsql modules.

absci commented 1 week ago

Hi, Cloudlinux/AlmaLinux is not one of our supported platforms, is it possible for you to use other systems? The support matrix is here.

d4em0nsp4wn commented 1 week ago

Hi, Cloudlinux/AlmaLinux is not one of our supported platforms, is it possible for you to use other systems? The support matrix is here.

It is not possible. I am curious what might be missing from this platform since it is a RHEL Clone.