when does mysql_pconnect() connection gets closed

2.4k Views Asked by At

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 ?

2

There are 2 best solutions below

0
On BEST ANSWER
0
On

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.