I've already read all the questions / answers about this subject here on stack overflow but unfortunately none have resolved my problem.
In the last few days the mysql error "too many connections" keeps showing up on the website logs and it hangs the entire website for every client. In fact it hangs all the websites on the server.
So here are my questions / remarks:
- there are about 50 different client databases, besides 2 which are common to all clients
- pconnect is already = FALSE for all connections
- On the file "php.ini" the variable "allowpersistent" is ON. Does this make the mysql connections permanent even if I write pconnect = FALSE? (I can't change the "allowpersistent" variable, would have to ask the hosting company)
- There are 3 files that load databases, one loads the client's DB and the other two load common databases for all clients, they are called on the construct method of every model, but CI supposedly should close the mysql connections after its done with them AND ignore any "load->database" already loaded
- "db->close" apparently does nothing, because this->db->database keeps its value after I close it :P
- Threads_connected are up to 1000 as I write this and the website is down :(
- mysql configuration has max_connections = 1000, can it be further increased? I see no change in free memory, so what can happen?
- Should I change to PDO? I'm using dbdriver "mysqli"
- Should I ask the hosting company to lower the mysql variable 'wait_timeout', so as to rapidly close the DB connection?
- Should I update CodeIgniter? I have version 3.1.4 and it's now at 3.1.9
Many thanks for your help!