Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account


What if the mysql database connection resources cannot be released in CI framework?

2024-06-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >


Shulou( Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To



© 2024 SLNews company. All rights reserved.