CodeIgniter opens many connections to the Database

3

I have an application on the client and they are complaining that it is opening many connections to the database, causing the server to crash.

I searched the internet and did not find anything related.

I would like to know if CodeIgniter automatically closes the connection to the bank when it is done or if it has something to close.

I'm new to CodeIgniter and the application was already done when I joined here. It is using Active Record to do the queries .

    
asked by anonymous 17.06.2014 / 16:06

1 answer

1

In application/config/database.php , check that the $db['default']['pconnect'] = TRUE; setting places FALSE , because with TRUE the connection is persistent.

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'senha';
$db['default']['database'] = 'testdb';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE; // Coloque FALSE
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

    

17.06.2014 / 16:28