1
I’m getting some messages from my application, from many running connections.
PHP Warning: mysqli_connect(): (08004/1040): Too many connections in /home/rmour123/public_html/admin/conexao.php on line 31
Below the form I implemented:
public static function getInstance() {
if (!isset(self::$db)) {
try{
self::$db = mysqli_connect(HOST, USER, PASSWORD, DBNAME);
} catch (Exception $e) {
print "Erro: " . $e->getMessage();
}
}
return self::$db;
}
The question is this, am I with some slow routine and that is locking the other connections and thus reaching the limit set in MYSQL(In this case 150 connections)? Or is there something else I haven’t noticed?
Vc uses shared server?
– Sam
Hi @dvd, I use hostgator service from the simplest. In addition to being shared, I have 2 databases, one wordpress and another application on the same server.
– FBilac
That could be it. The database server has a limit and is not being sufficient.
– Sam
What would be the paleactive? Improve the performance of queries, to release faster connections in use?
– FBilac
If you tah closing the connections after using them?
– Sam
No, I only close the statement after use in the prepare function().
– FBilac