开发者

What happens when a MySQL connection is not closed? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

What happens if MySQL connections continually aren't closed on PHP pages?

If you forget sometimes to close the connection will be close in a while, automatically or will be stay open?

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
$db = mysql_select_db(DB_DATABASE);
.
.
your code
.
.
and you forget to mysql开发者_如何学JAVA_close($link);


From mysql_connect() function documentation:

Note

The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close().

PS. You should consider moving to PDO or at least mysqli driver.


MySQL connections are automatically closed at the end of the script's execution. See PHP docs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜