Forum Moderators: coopster
Using PHP 4, I open MySQL connections with:
---
$database = mysql_pconnect($db_host, $db_user, $db_pass);
---
I don't close this connection because official documentantion (http://es.php.net/mysql_pconnect) claims that "mysql_close() will not close links established by mysql_pconnec".
How can I close these connections? Thank you very much.
A common problem are result sets of large SELECT queries that may stay in memory long after there usefulness in the PHP script that requested the data has ended. These result sets are using available resources and could be the source of the resource problem you currently see.
The proper way to deal with this is carefully calling the mysql_free_result() function whenever returned data from a SELECT statement is no longer needed. This may free up enough resources for your MySQL server to run smoothly again.
Furthermore the behaviour of persistent connections can be tuned in your PHP.INI file with the mysql.allow_persistent and mysql.max_persistent settings.
A few resources in regards to persistent connections:
[php.net...]
[dev.mysql.com...]