Message: Configured database connection is persistent. Aborting

Demir Aksa picture Demir Aksa · Apr 4, 2015 · Viewed 11k times · Source

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

An uncaught Exception was encountered

Type: Exception

Message: Configured database connection is persistent. Aborting.

Filename: /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

Answer

Parker1090 picture Parker1090 · Apr 7, 2015

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

Modify your database.php config file and turn 'pconnect' to false. As part of the CI 3 Framework, it would be part of this array:

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

Or if your config file looks more like the CI 2 version:

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

A bit of searching seems to suggest that the database doesn't like a persistent connection, possible because of security reasons.