Some Poster55 Posted December 20, 2009 Share Posted December 20, 2009 Hi, Have a bit of an issue here and would appreciate some advice. Occasionally I'll get this error message on my site: PHP Notice: in file /runetrack/configure.php on line 2: mysql_connect() [function.mysql-connect]: User dbname already has more than 'max_user_connections' active connections User dbname already has more than 'max_user_connections' active connections Some days my site will be completely fine, but every so often for around ~20 minutes it will simply display the above error. I've searched around quite a bit for solutions, but was unable to locate any. Here's my phpinfo() page if that helps: http://runetrack.com/phpinfo.php Any ideas as to how to solve this or even what it could be caused by? Many thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/ Share on other sites More sharing options...
fenway Posted December 21, 2009 Share Posted December 21, 2009 Are you using persistent connections? Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/#findComment-981291 Share on other sites More sharing options...
Some Poster55 Posted December 21, 2009 Author Share Posted December 21, 2009 No, I don't believe so. I always connect to the database using mysql_connect(), and never mysql_pconnect(), if that's what makes a persistent connection. Checking my phpinfo() file, the mysql.allow_persistent directive is set to "Off" as well (I turned it off via the PHP INI file a while ago just to be safe). Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/#findComment-981842 Share on other sites More sharing options...
fenway Posted December 21, 2009 Share Posted December 21, 2009 And you're only connecting once per script? Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/#findComment-981921 Share on other sites More sharing options...
Some Poster55 Posted December 25, 2009 Author Share Posted December 25, 2009 Correct, I have a file called "configure.php" which only has this in it: <?php mysql_connect("localhost","database","password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); ?> I then put: include "configure.php"; At the top of all my scripts. I've also heard some people saying to always use mysql_close() at the end of my script, but as I thought MySQL connections closed when a page loads, this shouldn't be necessary? Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/#findComment-983940 Share on other sites More sharing options...
Some Poster55 Posted December 29, 2009 Author Share Posted December 29, 2009 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/#findComment-985659 Share on other sites More sharing options...
fenway Posted December 30, 2009 Share Posted December 30, 2009 Well, if your pages take a long time to load, and the max_connections is set really low, it's possible. Quote Link to comment https://forums.phpfreaks.com/topic/185746-error-mysql-exceeded-max_user_connections-active-connections/#findComment-985785 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.