corillo181 Posted June 8, 2008 Share Posted June 8, 2008 hi i had a website for time now and i got a mysql error i never got before Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/site/public_html/include/db.php on line 16 Too many connections Quote Link to comment https://forums.phpfreaks.com/topic/109199-mysql-error/ Share on other sites More sharing options...
jonsjava Posted June 8, 2008 Share Posted June 8, 2008 wow. I know the reason, but I never thought I'd ever see it actually happen. You need to add mysql_close($mysq_conn); (change $mysql_conn) to what your connection is named) at the bottom of all your scripts (when you're done pulling the queries. This should fix that issue. what's happening is you're getting too many site hits at the same time, and they are causing a connection bottle neck. Quote Link to comment https://forums.phpfreaks.com/topic/109199-mysql-error/#findComment-560147 Share on other sites More sharing options...
.josh Posted June 8, 2008 Share Posted June 8, 2008 wow. I know the reason, but I never thought I'd ever see it actually happen. You need to add mysql_close($mysq_conn); (change $mysql_conn) to what your connection is named) at the bottom of all your scripts (when you're done pulling the queries. This should fix that issue. what's happening is you're getting too many site hits at the same time, and they are causing a connection bottle neck. no not really...unless the script being executed takes long enough time to execute that he happens to be getting a whole bunch of requests at the same time...the connection is automatically closed at the end of the script. The only time it's really useful to use mysql_close is if you're done with mysql at the top of your script and you have a (large) amount of code left to run, it will just free it faster. Quote Link to comment https://forums.phpfreaks.com/topic/109199-mysql-error/#findComment-560211 Share on other sites More sharing options...
jonsjava Posted June 8, 2008 Share Posted June 8, 2008 The only time I've ever seen that error is in the case I mentioned above. If there is another instance where he'll get that error, please let me know too. I'd hate to code not knowing I could cause that type of error. Quote Link to comment https://forums.phpfreaks.com/topic/109199-mysql-error/#findComment-560217 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.