Re: mysql_pconnect()
| From: | Rasmus Lerdorf | Date: | Tue, 04 Jul 2000 00:15:18 +0000 |
| Subject: | Re: mysql_pconnect() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4612@lists.php.net to get a copy of this message | ||
> > Can any of the developers explain how mysql_pconnect() works?
> > Is the connection persistent only for the httpd child that connected or
> > can it be used by any child as long as the connection is for the same
> > user with same password ?
> > If so, how is the connection closed afterwards ?
>
> As I understand it:
> One HTTP child gets a connection, and holds on to it.
> If the next mysql_pconnect() through that child is for the same server,
> same user, same password, then it reuses it. If not, it closes it and
> makes a new one.
> The last connection opened for that child is open until that child dies,
> or until some other connection is requested.
Correct except connections are not closed. A single httpd can have
multiple persistent connections to different databases or to the same
databases with different credentials.
The different credentials part is changing slightly as Monty has
implemented a mysql_change_user() API function in 3.23.17+ which lets us
reuse a persistent connection if the only difference is the login
credentials.
-Rasmus