$db['default']['pconnect'] = TRUE; |
[eluser]matt2012[/eluser]
What do people think about this as a default setting Code: $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, Code: $db['default']['pconnect'] = FALSE; but I wondered what other people thought.
[eluser]adamp1[/eluser]
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.
[eluser]Lone[/eluser]
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. http://lab.pxwebdesign.com.au/general/st...-in-php/11 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?
[eluser]nirbhab[/eluser]
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. |
Welcome Guest, Not a member yet? Register Sign In |