Forum Moderators: coopster

Message Too Old, No Replies

Too many connections

emergency help/advice needed

         

chrisandsarah

4:41 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Hi
I keep getting this when i try to access my site online:
Warning: Too many connections in /usr/local/psa/home/vhosts/mydomain.com/classes/mysql.php on line 15

Warning: MySQL Connection Failed: Too many connections in /usr/local/psa/home/vhosts/mydomain.com/classes/mysql.php on line 15

I'm no php programmer and the guy I use has gone for the day (he did send me some code but it hasnt fixed it, see code below).
Can anyone tell me if this is something can be fixed by my host? I read somewhere that it was a setting on the host that they need to change to allow more connections.

----------
I replaced some code in my mysql file with this which the programmer guy sent me:

function MySQLDB() {
if ($this->port!= 0) $this->host .= ":".$this->port;
$this->linkID = mysql_connect($this->host,$this->user,$this->password);

register_shutdown_function ( array($this, "MySQLDBClose") );

return $this->linkID;
}

function MySQLDBClose()
{
@mysql_close($this->linkID);
}

Many thanks if someone can help. my site has been down for the last our because of this.

bcolflesh

4:45 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your host needs to fix this server-side. There is nothing you can do, except make sure that all your scripts close properly.

Some reading:

mysql.com/doc/en/Too_many_connections.html

RussellC

4:51 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



if you have telnet access to the server you can use:

mysql -uroot -p --set-varible max_connections=200

to set the number of connections higher.

chrisandsarah

11:29 am on Jan 22, 2004 (gmt 0)

10+ Year Member



thanks for your help. I sent my host an email telling them what people had saif in here, but the problem had stopped by the time they checked out my site. they told me this:
------------------------
Dear Sir,
No, you don't have telnet access...as telnet access would never be
allowed to anyone, due to it's insecure nature.
There are currently only 44 mysql connections, so if you are getting
an error about max_connections, there is no server side reason for it.
As you didn't provide any url that we could duplicate the error with,
I am unable to suggest anything else. I did howerver goto your site
and click around to a few things that looked as though they might use a
mysql connection, and encountered no errors.
--
If you have any other questions, please let us know.
--------------------------
Alot of help they were..
The problem has now started again.

coopster

12:22 pm on Jan 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



As bcolflesh stated earlier, the MySQL configuration is controlled by the host and they more than likely are not going to allow anyone to change directives.

Most command line access nowadays is not performed via telnet, but SSH. There is a free program called PuTTY that works nicely. Google for PuTTY SSH and I'm sure you'll find a download. That said, you still aren't going to be able to change the MySQL config.

The only people that may to be able to troubleshoot this will be your hosting provider -- contact them as soon as the issue occurs. About the only thing you can do, as bcolflesh also stated, is make sure your scripts are closing properly.