Re: shouldn't mysql_pconnect force reuse of mysql connections?
| From: | Jeremy Zawodny | Date: | Tue, 19 Aug 2003 18:14:44 +0000 |
| Subject: | Re: shouldn't mysql_pconnect force reuse of mysql connections? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160048@lists.php.net to get a copy of this message | ||
On Tue, Aug 19, 2003 at 06:42:40PM +0200, anders thoresson wrote:
> Hi,
>
> I have this function I call everytime I need to make a query from within
> my php-scripts:
>
> function db_connect ($user, $pwd, $db, $debug = 0)
> {
> $link = @mysql_pconnect("localhost", "$user", "$pwd");
> if($link && mysql_select_db("$db"))
> if($debug == 1) {
> printf("Connection OK!");
> }
> Return ($link);
> if($debug == 1) {
> printf("Connection not ok!");
> }
> Return (FALSE);
> }
>
> I thought that making another or a third call to db_connect would reuse
> the same connection to the database, since I use mysql_pconnect() to
> connect. But listing the active processes indicates something else:
This is not a MySQL issue.
Doesn't Apache/PHP do this on a per-child basis? I don't believe it
uses a global connection pool...
Jeremy
--
Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo!
<Jeremy@Zawodny.com> | http://jeremy.zawodny.com/
MySQL 4.0.13: up 18 days, processed 902,104,223 queries (579/sec. avg)