title: Connection failed: could not find driver, PHP7.1 SqlServer, Windows Server 2012R2, IIS
body: <p>I'm attempting to get PHP 7.1 to connect to an instance of SQL Server on the same network, I get the following error: </p>
  
  <blockquote>
    <p>Connection failed: could not find driver</p>
  </blockquote>
  
  <p>I've downloaded and added both php_pdo_sqlsrv.dll and php_sqlsrv.dll (both nts versions). I have tried both the most recent release of, AND, the pre-release versions that supposedly fix an error with the .dll files not working with PHP 7.1.</p>
  
  <p>Both files have been added in our php.ini file as well.</p>
  
  <p>PHP file that should connect to the DB.. </p>
  
  <pre><code>&lt;?php
  
  error_reporting(E_ALL);
  ini_set('display_errors', 1);
  
  $serverName = "######";
  // $myUser = "#####";
  // $myPass = "######^";
  // $dbName = "######";
  
  //connection to the database
  try {
    $conn = new PDO("sqlsrv:Server=($serverName,53000);port=1433;Database=$dbName", NULL, NULL);
    // set the PDO error mode to exception
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully";
  }
  catch(PDOException $e){
    echo "Connection failed: " . $e-&gt;getMessage();
  }
  
  $conn = null;
  ?&gt;
  </code></pre>
  
  <p>The PHP.ini section currently looks like this:</p>
  
  <pre><code>extension=php_pdo_odbc.dll
  ;extension=php_pdo_pgsql.dll
  ;extension=php_pdo_sqlite.dll
  ;extension=php_pgsql.dll
  ;extension=php_shmop.dll
  ;extension=php_sqlsrv_71_nts.dll
  ;extension=php_pdo_sqlsrv_71_nts.dll
  extension=php_pdo_sqlsrv.dll
  ;extension=php_pdo_sqlsrv_54_nts.dll
  ;extension=php_sqlsrv_53_nts.dll
  extension=php_sqlsrv.dll
  </code></pre>
  
  <p>php -info only shows odbc under "PDO drivers" - which I believe indicates that it isn't activating.</p>
  
  <p>Have restarted the server multiple times.</p>
  
  <p>Any help is much appreciated, thanks!</p>