Codeigniter database connection error and db_select
I will try to be brief and precise.
- I am using Codeigniter 3.1.4. with HMVC
- Works well on localhost with
'pconnect' = FALSE;
- The problem is on a real server via shared hosting.
-
max_user_connections = 10
... Installed by the hosting company. - Also added
mysql.allow_persistent = Off
to php.ini file. - Gives an error
Message: mysqli::real_connect(): (42000/1203): User <user> already has more than 'max_user_connections' active connections Filename:mysqli/mysqli_driver.php Line Number: 201
-
Line 201
callsmysqli::real_connect
in db_connect function mysqli_driver - The official CI expression is "... CodeIgniter intelligently takes care of closing database connections."
With pconnect = FALSE;
and CI smartly closing database connections, I can't see what should be causing the problem.
EDIT
- Previously, a group of databases was loaded via
$this->load->database('group', TRUE);
in each model (only one such call per model). - Tried to resolve the above error by autoloading the database library and setting
$this->db->db_select('dbName');
to the appropriate controllers + models, but not always selecting the correct database when loading the controller model +. - Does anyone know how it works
db->db_select()
?
Any ideas would be a great help. Thank.
+3
source to share