Darn it. Didn't change the e-mail recipient to be the list.
---------- Forwarded message ---------- From: Fergus Gibson <[EMAIL PROTECTED]> Date: Tue, Nov 25, 2008 at 12:02 PM Subject: Re: [PHP-DB] MySQLi not closing connections To: Jonathan Langevin <[EMAIL PROTECTED]> On Tue, Nov 25, 2008 at 6:31 AM, Jonathan Langevin <[EMAIL PROTECTED]> wrote: > The problem is, this activity log, when enabled, results in all MySQL > connections being used, and we run out of open connections. I'm not > sure where the error is. > > Our config.php, when included, initializes the MySQL or MySQLi > connection as decided by the script that included the config. [...] Hi, Jon. It's difficult to offer specific replies without specific code, but I did raise my eyebrow at the notion of mixing the mysql and mysqli extensions in your application. I'm guessing you've inherited some pretty messy code that is time-consuming to refactor. Is any of the code working against the mysql extension calling mysql_pconnect() to create a persistent database connection? Connections so opened CANNOT be closed using mysql_close(). I have never written an application using persistent connections, but I did get hired at a company where the other programmers describe the same problem you're having (a proliferation of connections that overwhelmed the server). They blamed mysql_pconnect() and the lead programmer said that after he banned the use of that function, the problem went away completely. A comment to the PHP documentation suggests this is the result of a bad interaction between Apache and PHP. > Within the same file, a shutdown function is registered to > automatically close the MySQL or MySQLi connection at the end of > script execution (based on which connection was initialized to begin > with). This should not be necessary. The script will close all open resources when it terminates anyway. The reason for having and using close functions is to free resources while the script is still running. As mentioned above, persistent connections created by mysql_pconnect() cannot be closed by mysql_close() under any circumstances, nor will they automatically close on completion of the script. I believe that's your problem. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php