What if the mysql database connection resources cannot be released in CI framework?
This article will explain in detail about the CI framework mysql database connection resources can not be released how to do, the editor thinks it is very practical, so share to you to do a reference, I hope you can get something after reading this article.
The details are as follows:
Use the classes provided by the ci framework to query data:
$this- > load- > database (); $query = $this- > db- > query ($sql)
After the program has been running for a period of time, it reports an error and informs the database too many connections
It is clear that the MySQL database connection resource exceeds the max_connections setting. Immediately after each query, add a resource release script:
$this- > db- > close ()
Still unable to release resources, what should I do? After checking the manual, you know that all you have to do is set pconnect to false, which is roughly as follows:
$db ['default'] [' pconnect'] = FALSE
Once set, there is no need to call the
$this- > db- > close ()
The connection can be closed automatically.
On the "CI framework mysql database connection resources can not release what to do" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.