Should I close database connections after use in PHP?
Posted
by
Sprottenwels
on Programmers
See other posts from Programmers
or by Sprottenwels
Published on 2013-10-17T10:51:48Z
Indexed on
2013/10/17
16:23 UTC
Read the original article
Hit count: 264
I wonder if I should close any unnecessary database connection inside of my PHP scripts.
I am aware of the fact that database connections are closed implicitly when the block stops executing and 'manually' closing the connections could kinda bloat the codebase with unnecessary code.
But shouldn't I do so in order to make by code as readable and as easy understandable as possible, while also preventing several possible issues during run time?
Also, if I would do, would it be enough to unset()
my database object?
© Programmers or respective owner