title: Connecting php 7.2 to MS SQL using sqlsrv
body: <p>I'm trying to get a connection to MS SQL up and running via PHP on my machine.  I'm running IIS, have PHP 7.2 installed and MS SQL Express 2017.  I have my basic web page running but when I click to open the PHP page, the connection does not work.</p>
  
  <pre class="lang-php prettyprint-override"><code>session_start();
  
  echo "Hello ";
  if (isset($_POST['submit'])) {
      $_SESSION["server"] = $_POST['server'];
      $_SESSION["database"]= $_POST['database'];
      $_SESSION["username"] = $_POST['username'];
      $_SESSION["password"] = $_POST['password'];
  
      echo $_SESSION["database"];
  
      //CONNECTION
      $serverName = $_SESSION["server"];
      $connectionInfo["Database"] = $_SESSION["database"];
      $connectionInfo["UID"] = $_SESSION["username"];
      $connectionInfo["PWD"] = $_SESSION["password"];
  
      echo "midway";
  
      $conn = sqlsrv_connect($serverName, $connectionInfo);
  
      echo "Bye";
  }
  </code></pre>
  
  <p>When I run this I get "Hello dimensions midway" which suggests the page is working until it hits the connection line.<br>
  I am not sure what sqlsrv extension to use.<br>
  I have looked around and can see versions for 7 and 7.1 but not for 7.2.</p>
  
  <p>I have added in <code>extension=php_sqlsrv_71_nts_x86.dll</code> to the bottom of php.ini (and the file exists in <code>C:\Program Files (x86)\PHP\v7.2\ext</code>).</p>
  
  <p>Any pointers would be gratefully received. I've spent a couple of days on this and don't think I'm getting anywhere.<br>
  Thanks</p>