[wp-hackers] Closing Mysql connections

Otto otto at ottodestruct.com
Fri Mar 19 14:33:39 UTC 2010


On Fri, Mar 19, 2010 at 7:57 AM, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:
> The reason for this is quite simple. WordPress uses the database throughout
> the execution of the script, It's needed until shutdown as you'd expect.

Yes. As it says here: http://php.net/mysql_close

"Using mysql_close() isn't usually necessary, as non-persistent open
links are automatically closed at the end of the script's execution.
See also freeing resources."

Now, that being said, I have seen odd setups freak out on this before,
but those setups are rare. If you're really paranoid about this sort
of thing:

add_action('shutdown_action_hook','close_up_shop');
function close_up_shop() {
  @mysql_close();
}

You can try it and see if you see a difference. I doubt that there will be any.

-Otto


More information about the wp-hackers mailing list