title: SQLSTATE[08S01] SQLDriverConnect: 20009 [unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist
body: <p>First of all I know there are many questions posted for the same issue. I have tried every thing but couldn't get it to work. I am trying to connect to SQL Server using PHP. I've configured FreeTDS and unixODBC correctly. I tried <strong>tsql</strong>, <strong>isql</strong> and <strong>telnet</strong> and it connects to the server without an issue. But when I try to connect using PHP and execute the script in browser, it gives me this error:</p>
  
  <p><strong>SQLSTATE[08S01] SQLDriverConnect: 20009 [unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist</strong></p>
  
  <p><strong>PHP Script</strong></p>
  
  <pre><code>&lt;?php
  
  putenv('ODBCSYSINI=/etc'); 
  putenv('ODBCINI=/etc/odbc.ini');
  try { 
    $dbh = new PDO('odbc:U18958173','&lt;USER_NAME&gt;','&lt;PASSWORD&gt;'); 
  } catch (PDOException $exception) { 
    echo $exception-&gt;getMessage(); 
    exit; 
  } 
  echo var_dump($dbh); 
  unset($dbh); 
  </code></pre>
  
  <p><strong>freetds.conf</strong></p>
  
  <pre><code>[U18958173]
  host = &lt;SERVER_IP&gt;
  instance = SQLEXPRESS
  #port = 1433
  tds version = auto
  client charset = UTF-8
  </code></pre>
  
  <p><strong>odbc.ini</strong></p>
  
  <pre><code>[U18958173]
  Driver = FreeTDS
  Description = MSSQL database for my nice app
  Servername = U18958173
  UserName = &lt;USER_NAME&gt;
  Password = &lt;PASSWORD&gt;
  Database = &lt;DATABASE&gt;
  TDS_VERSION = auto
  </code></pre>
  
  <p>When I browse my PHP script in browser it gives me the error I mentioned above. Please help me, I've been searching for the solution for the last 3 days. Thank you.</p>