Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-03 20:24:21 10月07日 Update

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.

Tags: Data resources databases what to do frameworks articles more queries good practical obvious content manuals articles time knowledge programs scripts settings references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info NVidia Apple OPPO Reno Huawei