[Webmakers] Webserver issue - databases

Karen Mellor Karen.Mellor at olis.ri.gov
Tue Oct 7 11:33:35 EDT 2014


Some of you who have pages that are supported through the state's database server may have noticed some issues this morning with pages not populating with data pulled in through mySQL databases on the state server.  For example, OLIS has a library search tool and continuing education course listings and registration set up with mySQL that were not working.
 
DoIT quickly fixed the problem, but let me know that this is a recurring problem and those of us using mySQL databases can help out by closing the connection to the database.  I am not that familiar with mySQL, so I cannot offer a solution, but we (OLIS) will be working on a solution for our website.  If anyone finds a solution and/or has more expertise in this area and would like to share, that would be super.
 
DoIT describes the problem this way:
 
It appears that the majority of Web Developers are using mysql_pconnect to make their connections to their DBs.
 
What is causing the problem is that they are NOT releasing or closing that connection when they exit their code.
 
This results in our running out of connections.
 
While pconnect is the preferred method of connecting to the DB, you MUST remember to release or close the connections when done!
 
If you don't wnat to close your connection, the just use mysql_connect.

Additional information:
 
Apparently there is no "pconnect close" option in PHP.
 
The simpler, better solution is to change mysql_pconnect to mysql_connect.
 
The latter drops the connection immediately when the web page closes.
 
Mysql_pconnect doesn't drop until the MySQL daemon is restarted or the server is rebooted which amounts to the same thing.
 
In 99.9% of the cases, pconnect is a bad idea.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserve.ri.gov/pipermail/webmakers/attachments/20141007/4ca83a89/attachment.html 


More information about the Webmakers mailing list