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 r
I have had similar problems with CodeIgniter in the past and they were caused by persistent connections in MySQL which is enabled by default in CodeIgniter. I used the SHOW PROCESSLIST
query in MySQL to view open connections, their current running query, the time (in seconds) the connection has been open for, etc. If the connection is idle the Command
field returned would contain Sleep
and the Info
field (the query) would be NULL
which is probably what your host is referring to. That's a good place to start with an issue like this.
Another thing that I want to note is a nuance of PHP, mysql_close
which is being called here from your controller's __destruct
method will not close a persistent MySQL connection. PHP will close non-persistent connections at the end of the script's execution so it is usually not necessary to call it.
I realize that you had said persistent connections were not enabled, this was how I went about debugging my problem which sounds very similar to your problem.