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?
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/
ethanh Posted October 26, 2012 Author Posted October 26, 2012 I am using mysql_connect() I only connect once every page that needs MySQL.
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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now