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! 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? 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). 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? 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? 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. 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. 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
Archived
This topic is now archived and is closed to further replies.