David Rivera
David Rivera

Reputation: 369

Add TrustServerCertificate=Yes to the connection string using Adminer and sqlsrv

I am getting the error on Adminer that my ODBC Driver failed the verification of the certificate provider.

So after looking around I found out I have to add this to the connection string: TrustServerCertificate=Yes but I have no idea how to do this using Adminer.

I am using sqlsrv, php8.1 and Adminer 4.8.1, and I am on Windows 10.

I looked around Adminer file but cant find where I can add this. I am not expert on php so if anyone could indicate me how to do this would appreciate it.

Upvotes: 2

Views: 3789

Answers (3)

Gisele Brugger
Gisele Brugger

Reputation: 11

Using Adminer version 4.8.1 with sqlserver. the error presented was: [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:self signed certificate] [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection. For solutions related to encryption errors, see https://go.microsoft.com/fwlink/?linkid=2226722

I changed this line:

Before: $_b=array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8");

After: $_b=array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8","TrustServerCertificate"=>"true");

Now its 100%

Upvotes: 0

Syed Saad Hassan
Syed Saad Hassan

Reputation: 1

For me instead of Yes the boolean true works $yb=array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8","TrustServerCertificate"=>true);

Upvotes: 0

gbrands
gbrands

Reputation: 1

This is not recommended, but you can find the relevant bit of code you are looking for at line 745. You will want to update the $yb variable to the following:

$yb=array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8","TrustServerCertificate"=>"Yes");

Upvotes: 0

Related Questions