title: SQLSTATE 08001 [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted
body: <p>I recently switched from IIS Express to IIS on Windows Server. When doing the migration I had problems recognizing PHP, I did the ODBC installation, etc. However, I got the following error even though I already have an SSL certificate.</p>
  <pre><code>Array
  (
       [0] =&gt; Array
           (
               [0] =&gt; 08001
               [SQLSTATE] =&gt; 08001
               [1] =&gt; -2146893019
               [code] =&gt; -2146893019
               [2] =&gt; [Microsoft][ODBC Driver 18 for SQL Server]SSL
  Provider: The certificate chain was issued by an authority that is not
  trusted.
  
               [message] =&gt; [Microsoft][ODBC Driver 18 for SQL Server]SSL
  Provider: The certificate chain was issued by an authority that is not
  trusted.
  
           )
  
       [1] =&gt; Array
           (
               [0] =&gt; 08001
               [SQLSTATE] =&gt; 08001
               [1] =&gt; -2146893019
               [code] =&gt; -2146893019
               [2] =&gt; [Microsoft][ODBC Driver 18 for SQL Server]Client
  unable to establish connection
               [message] =&gt; [Microsoft][ODBC Driver 18 for SQL
  Server]Client unable to establish connection
           )
  
  )
  </code></pre>
  <p>I want to believe that the problem is with the settings for the connection.  The database version is Microsoft SQL Server 2019.</p>
  <pre><code>&lt;?php
     $serverName = &quot;//serverName\instanceName&quot;;
     $connectionInfo = array( &quot;Database&quot;=&gt;&quot;Database&quot;, &quot;UID&quot;=&gt;&quot;UID&quot;,&quot;PWD&quot;=&gt;&quot;PWD&quot;);
     $connection = sqlsrv_connect( $serverName, $connectionInfo);
  
     if( !$connection ) {
       die(print_r( sqlsrv_errors(), true));
     }
  
  ?&gt;
  </code></pre>