Jump to content

Unusual too many pconnect connections


matfish

Recommended Posts

Hi,

 

I've been redeveloping a website but every page I hit it creates a new Id in "Show Processlist" on the database. This being after viewing quite a few pages I then get the "Too many connections to database" error. I have dedicated server and connections are set to unlimited.

 

This is obviously a coding issue. I require_once the connection.php script in the page header:

global $config;
global $db;

$db = mysql_pconnect($config['db_hostname'], $config['db_user'], $config['db_password']);

if (!$db){
//@ include($config['site_root']."errors/500.php");
echo "error: ".mysql_error();
exit;
}
  
global $db_name;
$db_name = $config['db_database'];
$db_select = mysql_select_db($db_name);

 

Do I have to mysql_close($result) after every query? Still doesnt seem to help.

 

Any ideas?

 

Many thanks

Link to comment
Share on other sites

When I update the Show Process List the time just keeps going up, its not closing any connections even though I close them at the end of the query?

 

Full Texts  	 Id  	 User  	 Host  	 db  	 Command  	 Time  	 State  	 Info
Kill 	989 	website 	localhost 	DATABASE 	Sleep 	36 	  	NULL
Kill 	998 	website 	localhost 	DATABASE 	Sleep 	7 	  	NULL
Kill 	999 	website 	localhost 	DATABASE 	Sleep 	4 	  	NULL
Kill 	1000 	website 	localhost 	DATABASE 	Sleep 	4 	  	NULL
Kill 	1001 	website 	localhost 	DATABASE 	Sleep 	4 	  	NULL
Kill 	1010 	website 	localhost 	DATABASE 	Query 	0 	NULL 	SHOW PROCESSLIST

 

 

Link to comment
Share on other sites

Hi thanks for the reply.

 

On another server I'm running PHP 5.1.6 with MySQLi (and using mysqli_pconnect) and only recently we are having the same "Too many connections" issue. Is there any way of finding out which script/page is causing such issues?

 

Many thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.