Jump to content


Photo

Too many connections


  • Please log in to reply
11 replies to this topic

#1 mailtome

mailtome
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 07:05 AM

Hi
I am getting the following error
PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /usr/share/pear/adodb/drivers/adodb-mysql.inc.php on line 340

Can anyone tell me the possible reasons for this


#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 25 April 2006 - 07:39 AM

you have reached the maximum number of concurrent connections to your mysql database.

Are you using mysql_pconnect() or mysql_connect() ?

I was using pconnect for a long time, and couldnt figure out the reason why it kept maxing out. Turned out every database conection stayed open and kept adding new connections on top.
wisewood: proven fact, I am both wise, and wooden.

#3 mailtome

mailtome
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 09:16 AM

[!--quoteo(post=368310:date=Apr 25 2006, 02:39 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 25 2006, 02:39 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
you have reached the maximum number of concurrent connections to your mysql database.

Are you using mysql_pconnect() or mysql_connect() ?

I was using pconnect for a long time, and couldnt figure out the reason why it kept maxing out. Turned out every database conection stayed open and kept adding new connections on top.
[/quote]
I am using mysql_connect

#4 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 25 April 2006 - 09:23 AM

Do you have a lot of users using the mysql database / your site at the same time?
wisewood: proven fact, I am both wise, and wooden.

#5 mailtome

mailtome
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 09:28 AM

No i dont think so a lot of users will be using it at the same time

#6 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 25 April 2006 - 09:46 AM

I cant remember where it is now, but there is a mysql ini file with a setting for max concurrent connections, simply increase that to the maximum connections you might require.

However, if you're not having many users online at once at the moment (less than 20 for example) and you're not using mysql_pconnect i see no reason why this should be max'ing your connections.


wisewood: proven fact, I am both wise, and wooden.

#7 mailtome

mailtome
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 10:07 AM

This is exactly what i want to know


#8 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 25 April 2006 - 10:13 AM

Perhaps a simpler option would be to use mysql_close at the end of your scripts and to restart your server - that will kill any connections currently persisting.
follow me on twitter @PHPsycho

#9 mailtome

mailtome
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 10:21 AM

I close the connections when ever I open them. But I think that should not matter because I am using mysql_connect. This is from PHP documentation
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.


#10 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 25 April 2006 - 10:41 AM

I can only suggest finding out what the current max connections is set to, and how many connections you have running.

In phpmyadmin you can find out what connections there are by doing the following;

From the main page choose "show processes"
This will display all active connections.

At present mine shows two connections, and we have 7 users currently online, each with an automatic query running every 60 seconds.


wisewood: proven fact, I am both wise, and wooden.

#11 mailtome

mailtome
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 11:01 AM

you mean firing SHOW PROCESSLIST query and comparing it with max_connections?

#12 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 25 April 2006 - 11:10 AM

exactly. Still dont understand how you've got max connections on if you're not letting anyone use the script except yourself and you're not using pconnect though.

Is this a local install or is it on an ISP installation? Have you used this before for other projects?
wisewood: proven fact, I am both wise, and wooden.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users