Advantages / Disadvantages of pconnect option in CodeIgniter
Just look up general best practices for persistent connections. My suggestions.
- By default, DO NOT
- If you have:
- Dedicated web server and database hardware in production
- and have tuned the web server and database correctly
- and have an accurate production-like test environment
- And still think your performance problems are caused by database connection time,
CONSIDER turning it on
Persistent connections can cause
- Bugs because some connection state persisted unintentionally (this is a biggie!)
- Database connection limits to be exceeded
- Database performance to drop because of lots of ram used by the many (mostly idle) connections
- Bugs because connections have gone "stale" and the app didn't notice
But CAN
- Reduce latency on initial connection
If you think that connection latency is causing a problem, consider turning it on in your performance test system and measuring the impact.
Mysql Connection is rapidly increasing including Queries
pconnect is true in your case, that is, your settings are to use a persistent connection. In this case, whenever you create a new connection, the number of connections is increased. You need to close the connection in this case. You can set pconnect to false as well, but you need to think about it before you do it. You might need a persistent connections in some scenarios. See here:
Advantages / Disadvantages of pconnect option in CodeIgniter
errors in database and requeste not allowed using codeigniter
When you set $db[‘default’][‘db_debug’] = FALSE
It means it hides your database errors but It does not mean your database errors will solve.
The error message you got says the real reason what problem you are getting
Open your config/database.php
and check the database credential(hostname,username,password,database,dbdriver
and may be others) you provided is OK.The error message says they are not OK.
When Im swtiching from mysql to mysqli driver I get too many connections error. Why?
Sometime the most obvious answers are staring at you...
I stated that
$res = $q->result('Water_consumption');
would make a connection each time.
BUT when using
$res = $q->result();
it didn't.
It turns out that each Water_consumption
is extended from another class that makes a connection for handling login stuff. And that class is making a connection, so
$res = $q->result('Water_consumption');
that contained two objects would make two connections.
But the same would happen here..
$x = new Water_consumption;
$x = new Water_consumption;
This would also create two connections.
More than max_user_connections in CodeIgniter app?
Local path as I see shows you file where your error happened, because your driver /Applications/MAMP/htdocs/expertinfo/system/database/drivers/mysql/mysql_driver.php
possible on it's 88 line contain connect() function and it raise an exception
The problem is with your mydb24.surftown.se
remote server, you should check your access credentials, etc. to find what exactly happened
Related Topics
How to Check If a Video Exists on Youtube, Using PHP
How to Fetch All in Assoc Array from a Prepared Statement
Sqlstate[Hy000] [1045] Access Denied for User 'Username'@'Localhost' Using Cakephp
Pre-Declare All Private/Local Variables
PHP Send Mail to Multiple Email Addresses
Create a Comma-Separated String from a Single Column of an Array of Objects
PHP Remove Duplicate Values from Multidimensional Array
How to Type Hint More Than One Type
How to Run the PHP Code Asynchronous
Using Password_Hash and Password_Verify
Hiding True Database Object Id in Url'S
How to Create a Psr-4 Autoloader for My Project
PHP HTML Domdocument Getelementbyid Problems
Transfer In-Memory Data to Ftp Server Without Using Intermediate File