mattgagnon Posted December 8, 2005 Posted December 8, 2005 Hello, I'm getting an error about too many db connections. Our site is very busy at this time of year, so my customers and I keep getting errors about too many database connections. In the database functions, there is one called tep_db_close, but I have yet to find a script anywhere on the site that calls it. Questions: 1. Does osCommerce close a database connection after the page is rendered? 2. What can I do to stop this error from occurring? FYI, my configure.php file has been set to not use persistent connections, as such: define('USE_PCONNECT', 'false'); // use persistent connections? Any help would be appreciated as to why this might be happening. Thanks, Matt www.WhitehorsePress.com
adiwillow Posted December 8, 2005 Posted December 8, 2005 This is most likely coming from your host... MYsql has a set number of connections which can be allowed at once. If you're on a shared server then it will be low. A dedicated server will allow you to increase it.
mattgagnon Posted December 8, 2005 Author Posted December 8, 2005 Thanks. That's what I thought, but I guess I just wanted confirmation. Gotta go upgrade my hosting plan, I guess. :( Matt
mattgagnon Posted December 8, 2005 Author Posted December 8, 2005 But does anyone but me find it odd that a function exists for closing the database connection, but nowhere is it called? Shouldn't we all be closing our database connections after every access? Matt
AllenConquest Posted August 18, 2009 Posted August 18, 2009 But does anyone but me find it odd that a function exists for closing the database connection, but nowhere is it called? Shouldn't we all be closing our database connections after every access? Matt I find this very strange, and my host has just reduced the maximum number of allowed connections and I'm getting these problems. Why doesn't osCommerce ever close and database connections ? Allen
♥ecartz Posted August 18, 2009 Posted August 18, 2009 In general, PHP will implicitly close the connection after rendering the page. If you are not getting that behavior, you could simply add a call to tep_db_close in includes/application_bottom.php. It should be the last statement in the file. Only the ?> (if present) should be after it. Note that this can cause trouble if you are using shared links or if you start using shared links in the future (which may be why osCommerce leaves it out). Check out the php.net manual entry on mysql_close for more information. Always back up before making changes.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.