[Wolves] PHP/mySQL persistant connection or not?

David Goodwin david at openminds.co.uk
Mon Dec 29 16:25:46 GMT 2003


On Mon, 2003-12-29 at 16:15, Matthew Revell wrote:
> David Goodwin said:
> 
> > On Mon, 2003-12-29 at 15:47, Matthew Revell wrote:
> 
> >> Just a quick question: persistant mySQL connections in PHP, or not?
> >
> >
> > Ideally - Yes. As opening a connection to a database takes time, and
> > slows stuff down if the site is busy. Persistant connections should
> > remain open all the time, resulting in a slight overhead, but better
> > performance.
> 
> Would it sound stupid to ask if there are any security implications? If a
> connection is open all the time, is there the chance it could get
> hijacked? Or is that just not something that can happen?
> 
> > However, last time I used PHP, it's persistant connections were lacking
> > somewhat. As I understand it, each request to a PHP page spawns a new
> > PHP process. PHP has no shared context (unlike JSP/Java Servlets which
> > are threaded etc), so it is not possible to share that connection
> > between multiple seperate requests (because PHP is not threaded...).
> 
> >From what I've read, that depends on whether you're running PHP as a CGI
> wrapper or a module within Apache. But hey, I'm very much a beginner...
-- 
Technical Consultant
Open Minds High Availability Solutions
w : http://openminds.co.uk
e : david.goodwin at openminds.co.uk
t : +44 (0)121 313 3947 f : +44 (0)121 313 3944
It may well be. I only used it as a module within Apache.

I don't know if there are any security implications with regards to using 
persistant connections.... but would hope that there aren't!

thanks

David.




More information about the Wolves mailing list