title: CodeIgniter MSSQL connection
body: <p>I'm working on a web project that is to be deployed on a 64bit Windows 2008 Server machine running IIS 7.5 and PHP 5.3.8. The database on the system is Microsoft SQL Server 2008 R2. I'm developing the application on the CodeIgniter 2.1.0 framework, and I'm a bit stumped on getting it to connect to the SQL Server.</p>
  
  <p>I've tried using both the MSSQL, ODBC and SQLSRV database drivers, and have encountered three separate errors, for each different driver.</p>
  
  <p>Here is my configuration for ODBC:</p>
  
  <pre><code>$db['default']['hostname'] = 'SA';
  $db['default']['username'] = 'petre';
  $db['default']['password'] = 'start';
  $db['default']['database'] = 'petre';
  $db['default']['dbdriver'] = 'odbc';
  $db['default']['dbprefix'] = '';
  $db['default']['pconnect'] = TRUE;
  $db['default']['db_debug'] = TRUE;
  $db['default']['cache_on'] = FALSE;
  $db['default']['cachedir'] = '';
  $db['default']['char_set'] = 'utf8';
  $db['default']['dbcollat'] = 'utf8_general_ci';
  $db['default']['swap_pre'] = '';
  $db['default']['autoinit'] = TRUE;
  $db['default']['stricton'] = FALSE;
  </code></pre>
  
  <p>I have the DNS for SA defined under Data Sources, and I'm sure that the username and password are both valid, and that the server accepts Mixed authentication(Windows + SQL authentication).</p>
  
  <p>I'm auto-loading the DB library and for any page I access I get:</p>
  
  <pre><code>Unable to connect to your database server using the provided settings.
  Filename: C:\inetpub\wwwroot\system\database\DB_driver.php
  Line Number: 124
  </code></pre>
  
  <p>If I try to connect via MSSQL, I just get a blank page, no matter what.</p>
  
  <p>If I try using SQLSRV using the following params:</p>
  
  <pre><code>$db['default']['hostname'] = '127.0.0.1';
  $db['default']['username'] = 'petre';
  $db['default']['password'] = 'start';
  $db['default']['database'] = 'petre';
  $db['default']['dbdriver'] = 'sqlsrv';
  </code></pre>
  
  <p>Even though I'm linking to the sqlsrv DLL file in php.ini, I get the following message:</p>
  
  <pre><code>PHP Fatal error:  Call to undefined function sqlsrv_connect() in C:\inetpub\wwwroot\system\database\drivers\sqlsrv\sqlsrv_driver.php on line 76
  </code></pre>
  
  <p>I've been reading up on old posts and different views but I've yet to solve the problem.</p>
  
  <p>I'm only looking for a solution for a single DB Driver - anything that gets it to connect is fine. Does anyone have any advice on solving this?</p>