title: Can't connect to SQL Server from PHP
body: <p>I use XAMPP. I need to establish connection from PHP code to my MS SQL Server. Therefore, I installed the <code>sqlsrv</code> driver from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=20098" rel="nofollow noreferrer">here</a>. According to  <code>phpinfo()</code> it's being loaded properly:
  <a href="https://i.stack.imgur.com/nQP7j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nQP7j.png" alt="enter image description here"></a></p>
  
  <p>I get this error message:</p>
  
  <blockquote>
    <p>Connection could not be established. Array ( [0] => Array ( [0] =>
    IMSSP [SQLSTATE] => IMSSP  => -49 [code] => -49  => This
    extension requires the Microsoft ODBC Driver 11 for SQL Server. Access
    the following URL to download the ODBC Driver 11 for SQL Server for
    x86: <a href="http://go.microsoft.com/fwlink/?LinkId=163712" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=163712</a> [message] => This
    extension requires the Microsoft ODBC Driver 11 for SQL Server. Access
    the following URL to download the ODBC Driver 11 for SQL Server for
    x86: <a href="http://go.microsoft.com/fwlink/?LinkId=163712" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=163712</a> )  => Array (
    [0] => IM002 [SQLSTATE] => IM002  => 0 [code] => 0  =>
    [Microsoft][ODBC Driver Manager] Data source name not found and no
    default driver specified [message] => [Microsoft][ODBC Driver Manager]
    Data source name not found and no default driver specified ) )</p>
  </blockquote>
  
  <p>The links point to x86 client, but I can only install 64-bit version, which I did so from </p>
  
  <blockquote>
    <p><a href="https://www.microsoft.com/en-us/download/details.aspx?id=29065" rel="nofollow noreferrer">https://www.microsoft.com/en-us/download/details.aspx?id=29065</a></p>
  </blockquote>
  
  <p>Still I get the same error.</p>
  
  <p>Specs:</p>
  
  <blockquote>
    <p>OS: Windows Server 2012 64-bit </p>
    
    <p>PHP: 5.6.19</p>
  </blockquote>
  
  <p>Code is simple as that:</p>
  
  <pre><code>$serverName = "servername";
  $connectionInfo = array( "Database"=&gt;"DBname", "UID"=&gt;"username", "PWD"=&gt;"password");
  $conn = sqlsrv_connect($serverName, $connectionInfo);
  if( $conn ) {
       echo "Connection established.&lt;br /&gt;";
  }else{
       echo "Connection could not be established.&lt;br /&gt;";
       die( print_r( sqlsrv_errors(), true));
  }
  </code></pre>
  
  <p>Now what? Shall I register that installed SQL Native Client in any of the <code>PHP/Apache</code> conf files?</p>