RE: [PHP] Persistent Links help needed
| From: | Ford, Mike [LSS] | Date: | Wed, 13 Mar 2002 14:35:15 +0000 |
| Subject: | RE: [PHP] Persistent Links help needed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-88350@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: WG4- Cook, Janet [mailto:JCook@ICO.NEC.COM.AU]
> Sent: 13 March 2002 00:51
>
> Hi All,
> I have multiple PHP pages and make my connection to the MySQl
> db in one of
> these pages. When I go to the next one any mysql commands
> seem not to work
> - it look like the connection to the DB is lost! I have a
> feeling this is
> to do with persistent connections so here is the relevant parts of the
> phpinfo() output.
> My question is - what do I have to set and how do I do it so
> the connection
> remains
You can't -- it doesn't work like that.
or do I have to reconnect in every php file??
Yes -- there is no way to have a connection that persists between scripts.
A persistent connection is only persistent as far as your Web server's connection to MySQL is
concerned -- the advantage is that the Web server doesn't have to remake the connection each
time a script demands it. A non-persistent connection, however, is completely dropped when you
close it (either explicitly or by default when your script terminates), so that subsequent scripts
requiring an identical connection have to bear the cost of starting up a whole new connection to
MySQL. As far as your script is concerned, you can do nothing with persistent connections over and
above what you can do with non-persistent ones -- the difference is purely in how (often) the server
makes and breaks the connections.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211