Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.



Recommended Posts

I'm having some trouble with a site I set up recently. Approximately every other day I am getting at least one mysql connection error. It happened while I was on the site once (or else I would never have known about the problem) so I decided to trap and handle the error gracefully by displaying a much nicer message than "no mysql connection error " as well as send an email to me when it happens so I can monitor them (if anyone is interested check my posts for the simple code change). It's not like I'm getting 1000 visitors an hour, at any given time I might have 2 customers browsing so I'm not exhausting the database. But...I am on a shared server with 700 max connections allowed. So I could potentially have in theory (just being crazy) 100 mysql databases running on that one instance that is only allowed 700 connections...and now add a few users to each site...where does that leave me?

All of that leads to the question...mysql_pconnect or not? Am I wrong in understanding that p connect means persistent connection so every request does not require another connection to the database? If so then why would anyone opt NOT to use pconnect? I would appreciate any comments / suggestions.

Thank you very much for taking the time to read this post!

Kind Regards,


Link to comment
Share on other sites

You didn't say if you were using pconnect. I have read that mysql_pconnect can cause you to run out of database connections because each one is kept open.


Sorry about that. I an not using pconnect now, but was considering it. I do understand it keeps the connection open, but is it one connection for each customer and how long would the connection(s) stay open? I imagine it would have to time out eventually or close itself.


Thanks for the reply!


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...