"Too Many Connections" Error

From brokenpoet.org wiki

There are three things I have found to help this other than the obvious fix of raising the max_connections directive in the my.cnf (which 9 times out of 10 won't really fix anything).

First you can lower the wait_timeout to something like 10 or 15

Also you can put in interactive_timeout with a value of anything from 10-30

The third fix is probably the best depending on what the problem is . . .

This is to go into the php.ini file and disable persistent MySQL connections.

php -i |grep php.ini

Then, when you know where the file is, open it with your favorite text editor and look for this line:

; Allow or prevent persistent links.
mysql.allow_persistent = On

Simply change the value to Off and restart.

A note for PHP developers. You can find this error if your scripts open persistent connections, which aren't closed even if the script terminates. Use mysql_connect() instead of mysql_pconnect() unless you have a good reason. In particular, check this setting in third-party scripts (such as osCommerce).

Once persistent connections are disabled, scripts won't fail, they'll just use non-persistent connections silently.

Personal tools