title: Error With PHP7 and SQL Server on Windows
body: <p>I am getting "Fatal error: Invalid handle returned. in" in PHP 7 while trying to connect with SQL Server.</p>
  
  <p><strong>I have already tried below option</strong> </p>
  
  <p><a href="https://stackoverflow.com/questions/15651646/error-connecting-to-mssql-">Error connecting to MSSQL with SQLSrv and PHP 5.4.7</a>
  <a href="https://stackoverflow.com/questions/38222539/unable-to-connect-to-sql-server-with-php">Unable to connect to SQL Server with PHP</a></p>
  
  <p>I am using below code:</p>
  
  <pre><code>try {  
     $conn = new PDO( "sqlsrv:Server=(10.10.10.222\sql2008r2);Database=test",'sa', 'sipl@123');   
     $conn-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );  
  }  
  
  catch( PDOException $e ) {  
     die( "Error connecting to SQL Server" );   
  }  
  
  echo "Connected to SQL Server\n";  
  
  $query = 'SELECT *FROM atlas_positions';   
  $stmt = $conn-&gt;query( $query );   
  while ( $row = $stmt-&gt;fetch( PDO::FETCH_ASSOC ) ){   
      echo '&lt;pre&gt;';
      print_r( $row );   
      echo '&lt;/pre&gt;';
  } 
  </code></pre>
  
  <p>Your views will be beneficial for me.</p>