• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
$db['default']['pconnect'] = TRUE;

What do people think about this as a default setting

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

I ran into problems on a shared server with too many connections to the database.

Is this a common problem?

Ive now set it to,

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

but I wondered what other people thought.

I always set it to FALSE, due to issues on Shared hosts, also for what ever reason I don't know how true it is, but I was told by several people it wasn't as safe.

I know the benefits of leaving it open is less memory usage, but as all my sites are relatively small it doesn't seem to make much difference.

I would like to just put in on this and mention that I think it should default to FALSE as well because I ran into issues of "too many connections" due to pconnect being used and leaving too many sleeping connections.


I would really like to hear any advantages to having it on by default as most things I have read suggest not to use pconnect in php?

First, when connecting, it would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.

Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).

This type of link is therefore called 'persistent'.
so, pconnect is good to use, save resources to a huge extend.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.