title: Codeigniter - Fatal error to connect MySQL and SQL Server
body: <p>I need to connect to MySQL and SQL Server in same application. My php version 5.6.11 and codeigniter 3.0.1. The steps I followed to establish the connection below:</p>
  
  <ol>
  <li><p>I download this file and paste into xampp\php\ext</p>
  
  <p><strong>php_sqlsrv_56_ts</strong><br><strong>php_pdo_sqlsrv_56_ts</strong></p></li>
  <li><p>Edit php.ini file like this:</p>
  
  <p><strong>extension=php_sqlsrv_56_ts.dll</strong><br>
  <strong>extension=php_pdo_sqlsrv_56_ts.dll</strong></p></li>
  </ol>
  
  <p><strong>database.php</strong></p>
  
  <pre><code>$active_group = 'default';
  $query_builder = TRUE;
  
  $db['default'] = array(
      'dsn'   =&gt; '',
      'hostname' =&gt; 'localhost',
      'username' =&gt; 'root',
      'password' =&gt; '',
      'database' =&gt; 'vtp',
      'dbdriver' =&gt; 'mysqli',
      'dbprefix' =&gt; '',
      'pconnect' =&gt; FALSE,
      'db_debug' =&gt; (ENVIRONMENT !== 'production'),
      'cache_on' =&gt; FALSE,
      'cachedir' =&gt; '',
      'char_set' =&gt; 'utf8',
      'dbcollat' =&gt; 'utf8_general_ci',
      'swap_pre' =&gt; '',
      'encrypt' =&gt; FALSE,
      'compress' =&gt; FALSE,
      'stricton' =&gt; FALSE,
      'failover' =&gt; array(),
      'save_queries' =&gt; TRUE
  );
  
  $db['biodb'] = array(
      'hostname' =&gt; '192.168.20.231',
      'username' =&gt; 'abzalali',
      'password' =&gt; '',
      'database' =&gt; 'pdata',
      'dbdriver' =&gt; 'sqlsrv',
      'dbprefix' =&gt; '',
      'pconnect' =&gt; FALSE,
      'db_debug' =&gt; TRUE,
      'cache_on' =&gt; FALSE,
      'autoinit' =&gt; TRUE,
      'stricton' =&gt; FALSE,
  );
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>&lt;?php
  
  if (!defined('BASEPATH'))
      exit('No direct script access allowed');
  
  class biodb extends CI_Controller {
  
      public function __construct() {
  
          parent::__construct();
          $this-&gt;sqlsrvr = $this-&gt;load-&gt;database('biodb', true);
      }
  
      public function index() {
          $query = $biodb-&gt;get('arb_protest_pp');
          foreach ($query-&gt;result() as $row)
              echo $row-&gt;id;
      }
  
  }
  </code></pre>
  
  <p>Then I call the controller 'biodb' in url, and getting error:</p>
  
  <pre><code>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) in C:\xampp\htdocs\vtp\system\database\DB_driver.php on line 771
  </code></pre>
  
  <p>After that:
  I added a new line "<code>$this-&gt;db_select();</code>" in "DB_Driver.php" in this function </p>
  
  <pre><code>public function simple_query($sql)
  {
      if ( ! $this-&gt;conn_id)
      {
          $this-&gt;initialize();
      }
      $this-&gt;db_select();
      return $this-&gt;_execute($sql);
  }
  </code></pre>
  
  <p>And then I also getting another error:</p>
  
  <pre><code>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) in C:\xampp\htdocs\vtp\system\database\DB_driver.php on line 642
  </code></pre>
  
  <p>I really didn't find out what I missed actually. And I need to work with codeigniter active record this sqlserver db.</p>