Hoping someone may have some insight. I'm a PHP developer for my current employer. Recently, a coworker and myself started revamping our PHP-based intranet to add more OO functionality and replace some of the repetitive procedural code that was in place. In this revamp, we also converted the majority of our scripts to use MySQLi instead of MySQL. We're using the MySQLi class, which I've extended to add some logging functionality, and also incorporated some query builder methods (similar to what you'll see in CodeIgniter's Active Record class). To better troubleshoot semi-random bugs in our intranet, I've implemented an activity log in the database, to record all data in/out, current page, queries used, etc, which logs at the end of each page load. 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. 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). We never have connection issues during normal usage, but once the activity log is enabled (which will execute during shutdown), that is when we see the connections fill up fast. The weird thing is, to my knowledge, the same DB connection is being used, never duplicated. I've seen a PHP <5.3 bug that results in multiple connections being allowed when using the OO mysqli methods, but the mysqli class is only instantiated *once* per page load, same for the mysql procedural instance. The only possibility I can think of, is that normal mysql is being instantiated outside of the config.php include, but then we'd have connections disappearing continuously, not just when the activity log is enabled. I realize this is a long, and probably none-to-helpful email. If anyone can assist, I'd appreciate it. Any info you need, let me know. -- Jon L. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php