[nycphp-talk] When to close a mysql connection
David Krings
ramons at gmx.net
Mon Jul 2 08:43:12 EDT 2007
Cliff Hirsch wrote:
> Hey, just an aside for everyone.
>
> I always had my DB close statement as the last line of my scripts. Then one
> day, everything stopped working properly. Why?
>
> Seems right -- when you're done you're done -- right? Wrong. PHP does plenty
> of "stuff" after your script is finished.
>
> Remember -- if you use database-base sessions, use session_write_close
> BEFORE you close your DB connection. And you probably want to use
> session_write_close before any header redirects as well to eliminate timing
> issues.
>
> Cliff
Thanks for pointing this out. I will add it to my scripts as I make
frequent use of header redirects, they are just so effective.
Although I should know if I use database-based sessions, I am not sure
as I am not sure what exactly a database-based session is. So, what is that?
David
More information about the talk
mailing list