This article describes how to release mysql database connection resources in the CI framework. it analyzes the causes of connection exceeding the maximum value in the CI framework and the corresponding solutions, this article describes how to configure the CI framework. if you need it, you can refer to the examples in this article to analyze the solutions that the mysql database connection resources cannot be released. We will share this with you for your reference. The details are as follows:
Use the class provided by the ci framework to query data:
$ This-> load-> database (); $ query = $ this-> db-> query ($ SQL );
After running the program for a period of time, an error is reported to inform the database of too connector connections.
Obviously, the connection resource of the MySQL database exceeds the value set by max_connections. Immediately after each query, add the resource release script:
$ This-> db-> close ();
Resources cannot be released. what should I do? Check the manual,Set pconnect to false., The settings are roughly as follows:
$ Db ['default'] ['pconnect '] = FALSE;
You do not need to call
$ This-> db-> close ();
You can automatically close the connection.