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 — Closes a previously opened database connection
Description
Object oriented style (method):
bool mysqli::close
( void
)
Procedural style:
Closes a previously opened database connection.
Parameters
- link
-
Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()
Return Values
Returns TRUE on success or FALSE on failure.
Examples
See mysqli_connect().
See Also
- mysqli_connect() - Open a new connection to the MySQL server
- mysqli_init() - Initializes MySQLi and returns a resource for use with mysqli_real_connect()
- mysqli_real_connect() - Opens a connection to a mysql server
mysqli::close
php at dafydd dot com
07-Nov-2008 09:03
07-Nov-2008 09:03
win at alinto dot com
21-May-2008 09:52
21-May-2008 09: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."
