How CodeIgniter close db connections? |
There is a db->close() method. In a PHP environment that is not using persistent connections there is no real need to call it. For MySQL in particular, all open non-persistent MySQL connections and result sets are automatically destroyed when a PHP script finishes its execution. Which in CodeIgniter happens right after the controller method finishes. So you could call $this->db->close(); in some model or in a controller. But all you would accomplish is freeing up the connection resources a few microseconds earlier than if you let script execution finish.
If you have a high-demand situation and are therefore using persistent connections that is a different story. http://php.net/manual/en/features.persis...ctions.php |
Messages In This Thread |
How CodeIgniter close db connections? - by mouhong - 05-11-2017, 07:48 PM
RE: How CodeIgniter close db connections? - by dave friend - 05-15-2017, 02:44 PM
RE: How CodeIgniter close db connections? - by xuhaib - 05-22-2017, 03:12 AM
RE: How CodeIgniter close db connections? - by dave friend - 05-23-2017, 11:23 AM
RE: How CodeIgniter close db connections? - by xuhaib - 05-24-2017, 01:16 PM
RE: How CodeIgniter close db connections? - by dave friend - 05-25-2017, 10:13 AM
RE: How CodeIgniter close db connections? - by xuhaib - 05-27-2017, 09:46 AM
|