title: CodeIgniter database connections not being closed
body: <p>I have built a social community website in CodeIgniter which is now getting a fair bit of traffic, the hosting company have started complaining and saying that the database is receiving null connections as well as connections which aren't being closed.</p>
  
  <p>I am not entirely sure what a null query is or how one would end up being issued, any ideas?</p>
  
  <p>I have added in additional code to force close connections when the code reaches an end but apparently this isn't working.</p>
  
  <p>Can anyone offer any suggestions as to where to look or start debugging an issue like this?</p>
  
  <p>Thanks</p>
  
  <p>I have the following at the bottom of my core <code>MY_Controller</code></p>
  
  <pre><code>public function __destruct() {
      $this-&gt;db-&gt;close();
  }
  </code></pre>