If you are getting? Too many connections error when you try to open your website in browser, It means all available connection used by other script or mysql process. Number of connection to mysql server determined by setting in mysql conf? file.? By default,? it is 151? for MySQL 5.x and 100 for MySQL 4.x.? To change setting, open mysql conf file. In Linux it can be found (/etc/my.cnf) and in windows within installation folder. Find max_connections setting under [mysqld] section. This setting must be within [mysqld] section. Change setting which is suitable to you.
There are several reason that cause server to raise this error:
Persistent Connections: This is common cause of this error. If script uses persisit connection and script does? not close connection even if script terminates. To avoid this problem, try using mysql_connect() instead of mysql_pconnect(). Check this setting in third party script such as osCommerce. You can turn off this setting in php.ini file. Script using persist connection will use non-persistent connection without any warning or error if persistence connection disabled.
Server administrators can disable persistent connections for PHP scripts in php.ini file:
; Allow or prevent persistent links.
Lower MySQL Connect Timeout: Check your mysql connect timeout setting. By default it is 60 seconds and php setting lowering below the dafault setting.
For example: following setting in .htaccess php_value mysql.connect_timeout 25
The osCommerce setting mentioned by ?varo is in the catalog/includes/configure.php file:
define(‘USE_PCONNECT’, ‘false’); // use persistent connections?
It defaults to true, so mysql_pconnect() is used, and you get the error message “Warning: mysql_pconnect(): Too many connections …” Change to false for mysql_connect() to be used.