I've been using custom session handlers with an application for months now without problems, but recently started getting a "too many connections" error on my database (MySQL). The only part of my application that uses persistent connections is my session handler. I based it on the Ying article on custom session handlers at http://www.phpbuilder.com/columns/ying20000602.php3. It uses mysql_pconnect() to connect to the database, but I seem to end up with connections not being reused...instead, every page load creates a new persistent connection which then apparently goes to sleep until it dies. I determined this by running a "SHOW FULL PROCESSLIST" in MySQL. Can anyone think of a reason why the Ying tutorial uses persistent connections or why they wouldn't be reused like they're supposed be? Could we just as easily use mysql_connect()?
If I do switch to non-persistent connections, do I need to explicity close the connection or will it die once the script exits?