I've had situations where database connections appeared to persist following php execution. So, now, my __destructor function explicitly contains a $cxn->close(). It hurts nothing, and helps avoid memory leaks.
mysqli::close
mysqli_close
(PHP 5)
mysqli::close -- mysqli_close — Ferme une connexion
Description
Style orienté objet :
bool mysqli::close
( void
)
Style procédural :
Ferme la connexion spécifiée par le paramètre link .
Liste de paramètres
- link
-
Style procédural uniquement : Un identifiant de lien retourné par la fonction mysqli_connect() ou par la fonction mysqli_init()
Valeurs de retour
Cette fonction retourne TRUE en cas de succès, FALSE en cas d'échec.
mysqli::close
php at dafydd dot com
07-Nov-2008 01:03
07-Nov-2008 01:03
win at alinto dot com
21-May-2008 02:52
21-May-2008 02:52
There's nothing here about connexions automatically claused at the end of a script. About that, a little note from devzone.zend.com :
"Open connections (and similar resources) are automatically destroyed at the end of script execution. However, you should still close or free all connections, result sets and statement handles as soon as they are no longer required. This will help return resources to PHP and MySQL faster."
