ethanh Posted October 25, 2012 Posted October 25, 2012 I am connecting to my MySQL server using PHP and getting the error: Warning: mysql_connect() [function.mysql-connect]: Too many connections in file on line #Failed to connect to server: Too many connections I am using mysql_close() when I redirect or when the script stops. Why am I getting this error? Is there anyway to prevent this from happening? Quote
Shinryuu Posted October 25, 2012 Posted October 25, 2012 Are you using mysql_connect() or mysql_pconnect(), cause pconnect connections aren't closed by mysql_close(), also it's a good idea to minimize connection calls as IceIT Support explains here: http://www.helionet.org/index/topic/13237-help-with-reducing-mysql-load/ Quote
ethanh Posted October 26, 2012 Author Posted October 26, 2012 I am using mysql_connect() I only connect once every page that needs MySQL. Quote
ExtremeGaming Posted October 26, 2012 Posted October 26, 2012 Make sure you close the connection with mysql_close($connection); when you are done with every file containing sql, this will ensure it does not happen as frequent Quote
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.