[Wolves] PHP/mySQL persistant connection or not?

Matthew Revell wolveslug at understated.co.uk
Mon Dec 29 16:15:38 GMT 2003


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...

Thanks for your help!




More information about the Wolves mailing list