Message. The configured database connection is permanent. Aborting

Codeigniter version 2 to 3 after updating, I get this error. Why would that be?

An unrelated exception was found

Type: Exception

Message: The configured database connection is persistent. Aborting

File Name: /var/www/vhosts/xxx.com/app/system/libraries/Session/drivers/Session_database_driver.php

Line Number: 94

Backtrace:

File: /var/www/vhosts/xxx.com/app/application/core/MY_Controller.php Line: 11 Function: __construct

File: /var/www/vhosts/xxx.com/app/application/core/MY_Controller.php Line: 52 Function: __construct

File: /var/www/vhosts/xxx.com/app/application/controllers/Dashboard.php Line: 7 Function: __construct

File: /var/www/vhosts/xxx.com/application/index.php Line: 293 Function: require_once

+5
source share
4 answers

I had the same problem, and I found that it was just a matter of changing the settings:

Change the database.php configuration file and change 'pconnect' to false. Within the CI 3 Framework, it will be part of this array:

$db['default'] = array( 'pconnect' => FALSE // This value ); 

Or, if your configuration file is more like CI version 2:

 $db['default']['pconnect'] = FALSE; 

The search bit seems to indicate that the database does not like a persistent connection, possibly due to security concerns.

+12
source

Disable caching in database.php file, define caching folder in database.php file

 'cachedir' => APPPATH.'cache/db/', 

and use only

 $this->db->cache_on(); 

where you want your database query to be cached.

Do not forget to use

 $this->db->cache_off(); 

after selecting queries for unwanted cached results.

+1
source

It seems that codeigniter 3.0 does not support database sessions when persistent is enabled. form: http://www.codeigniter.com/user_guide/libraries/sessions.html?highlight=session#session-preferences

However, there are some conditions that must be met:

Only your connection to the default database (or the one you are accessing as $ this-> db from your controllers). You must have the Builder request enabled. You cannot use persistent connection. You cannot use the connection with the cache_on parameter enabled.

0
source

You need to make sure that FALSE is disabled without quotes. If you use FALSE, the database driver will accept this as a true boolean. The system expects you to use FALSE directly, without quotes. So unset pconnect instead of using FALSE so that the default is FALSE, or use FALSE as the value if you want to keep things in order :)

  * Persistent connection flag * * @var bool */ public $pconnect = FALSE; 
0
source

All Articles