'php to mssql server errro SSL Provider: The certificate chain was issued by an authority that is not trusted

first of all, im really noob.(sorry for that) secondly, iam trying to connect php to mssql server. thirdly, i already install sqlsrv, pdo_sqlsrv, and msodbcsql.msi but still get error message when trying to connect enter image description here enter image description here

my php version is 8.0.10, x64; mssql server 2012.

my code in php to test connection :

<?php
$serverName = "10.xxx.xx.148";
$connectionInfo = array( "Database"=>"zzzz", "UID"=>"ww","PWD"=>"123cccc");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
 echo "Connection established.<br />";
}else{
 echo "Connection could not be established.<br />";
 die( print_r( sqlsrv_errors(), true));}
?>

and then i get error, and instruction to install msodbcsql.msi, i install it just like the instruction. but then show new error that iam unable to solved.

Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 1 => -2146893019 [code] => -2146893019 2 => [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted. [message] => [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted. ) 1 => Array ( [0] => 08001 [SQLSTATE] => 08001 1 => -2146893019 [code] => -2146893019 2 => [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection [message] => [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection ) )

additional info: when i connect dbeaver (different pc) to mssql server (same server) there is no problem.

thank you in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source