2 function shutdown_mysql_close() {
3 // NOTE: fix things like this :
4 // Warning: mysql_select_db(): 2 is not a valid MySQL-Link resource in test.php
5 // which is likely due to php5-fpm not correctly destroying all PHP variables ;
6 // uses auto_prepend_file in php.ini :
7 // - works when script ends or exit() is called;
8 // - works when mysql.so is loaded or not;
9 // - not sure if this works with multiple MySQL connexions.
10 if(function_exists('mysql_close'))
13 register_shutdown_function('shutdown_mysql_close');