title: Laravel MSSQL Server Connection not working
body: <p>Laravel version:<code>7.13</code>, SqlServer:<code>2019</code></p>
  
  <pre><code> SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: 
   An existing connection was forcibly closed by the remote host (SQL: select * from [users]).
  </code></pre>
  
  <p>Above is error message what I got.</p>
  
  <p>I tried with core php and it works well.</p>
  
  <p>Below is php code.</p>
  
  <pre><code>&lt;?php
  
  $serverName = "MYPCNAME";
  $connectionInfo = array( "Database"=&gt;"DBNAME", "UID"=&gt;"sa", "PWD"=&gt;'MyPassword');
  $conn = sqlsrv_connect( $serverName, $connectionInfo);
  if( $conn ) {
       echo "Connection established.&lt;br /&gt;";
  
       if(($result = sqlsrv_query($conn,"SELECT * FROM users")) !== false){
          while( $obj = sqlsrv_fetch_object( $result )) {
                echo $obj-&gt;name.'&lt;br /&gt;';
          }
      }
  
  }else{
       echo "Connection could not be established.&lt;br /&gt;";
       die( print_r( sqlsrv_errors(), true));
  }
  
  ?&gt;
  </code></pre>
  
  <p>I think SQL Server configuration is correct. I installed php_sqlsrv, php_pdo_sqlsrv extensions and they are displayed as installed in <code>phpinfo()</code></p>
  
  <p>Here is my Laravel configuration.</p>
  
  <pre><code>DB_CONNECTION=sqlsrv
  DB_HOST=MYPCNAME
  DB_PORT=1433
  DB_DATABASE=DBNAME
  DB_USERNAME=sa
  DB_PASSWORD=MyPassword
  </code></pre>
  
  <p>Following is database config file.</p>
  
  <pre><code> 'sqlsrv' =&gt; [
              'driver' =&gt; 'sqlsrv',
              'url' =&gt; env('DATABASE_URL'),
              'host' =&gt; env('DB_HOST'),
              'port' =&gt; env('DB_PORT'),
              'database' =&gt; env('DB_DATABASE'),
              'username' =&gt; env('DB_USERNAME'),
              'password' =&gt; env('DB_PASSWORD'),
              'charset' =&gt; 'utf8',
              'prefix' =&gt; '',
              'prefix_indexes' =&gt; true,
          ],
  </code></pre>
  
  <p>I tried to change <code>DB_HOST</code> with <code>127.0.0.1</code> too but there was same issue.
  I was going to get users from users table. </p>
  
  <hr>
  
  <p>My thought: I changed server name with <code>127.0.0.1</code> in core php and it displayed exact same error with laravel.</p>
  
  <p>Can anyone help me?
  Thanks</p>