[Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: peer did not return a certificate (RHEL 8 and PHP 8.0)

acoder 5 Reputation points
2023-04-07T13:47:22.85+00:00

Using the documentation (1, 2) I installed the SQL Server driver for PHP/PDO on my RHEL 8 system running PHP 8.0. Everything looks good on installation. Using the supplied test script, I see the following error: Caught PDO exception:

SQLSTATE[08001]: [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol][error:140B40C7:SSL routines:SSL_do_handshake:peer did not return a certificate]

I've prevously used TSQL and did not use a security certificate (no PHI or sensitive info involved). Is there a way to not use SSL with the MS SQL-srv driver?

SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.8K Reputation points MVP Volunteer Moderator
    2023-04-07T21:09:04.8833333+00:00

    With the ODBC 18 driver (and all other recent drivers from Microsoft), the default is to require a trusted certificate for the encryption of the communication. That is, SQL Server must use a certificate which is in your trusted certificate store. You can use option Encrypt=False to decline encryption altogether or TrustServerCertificate to say that you think that the certificate provided by SQL Server is fine. In either case, you could be victim to a man-in-the-middle attack. That is, a process that reads the data you send to SQL Server and you get back.

    0 comments No comments

  2. Seeya Xi-MSFT 16,586 Reputation points
    2023-04-10T03:07:26.94+00:00

    Hi @acoder ,

    Here are some similar threads for your reference:

    https://github.com/microsoft/msphpsql/issues/1112

    https://stackoverflow.com/questions/65123031/odbc-driver-17-for-sql-serverssl-provider-error1425f102ssl-routinesssl-ch

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.