when does mysql_pconnect() connection gets closed
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.
精彩评论