PDA

View Full Version : mysql_connect(): Too many connections


danielwarner
02-01-2006, 04:47 PM
Warning: mysql_connect(): Too many connections in /home/toasted/domains/angrypirate.co.uk/public_html/band/config.php on line 8
Too many connections


define("DB_SERVER", "localhost");
define("DB_USER", "********");
define("DB_PASS", "********");
define("DB_NAME", "********");

mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME) or die(mysql_error());

line 8 is : "mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());"

any help with this one? i have no idea why its doing this

raf
02-02-2006, 09:29 AM
just a wild guess: maybe you have to many open connections.

check your MySQL config to see how many simultanies connections it allows + the logfile to see how many connections you have when you get the error.

NancyJ
02-02-2006, 10:20 AM
do you ever close your connections after you're finished using them?

raf
02-02-2006, 10:26 AM
he's not using persistent connections + php automatically closes the connection when the script finishes ...

from the code he shows: only one connection will be made inside the script (even if he would make multiple mysql_connect() calls), and this connection will automatically be closed when the script finishes. but of course, maybe in some other part of his script, he could be using a mysql_connect() with a new_link parameter or so)