开发者

when does mysql_pconnect() connection gets closed

开发者 https://www.devze.com 2023-01-08 07:29 出处:网络
It is know that开发者_开发知识库 connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close

It is know that开发者_开发知识库 connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).

So when does the mysql_pconnect() connection gets closed ?


You should read this:

http://www.php.net/manual/en/features.persistent-connections.php


pconnect connections closes only when:

a) apache is restarted/stopped

b) mysql is restarted/stopped

c) After a specified amount of time, as set in the my.cnf file

But it shouldn't matter anyways, as the point of opening a persistent connection is to keep it open and avoid the overhead of making a new connection anyways. If you do another pconnect, it'll just use the existing connection or make a new one if none exists.

0

精彩评论

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

关注公众号