Something most people who use PHP don’t know is that PHP is not a threading system. What this means is that you cannot have more than one task running simultaneously. If you try to start more processes than your max_user_connections setting allows then you will encounter the message: “Already has more than ‘max_user_connections’ active connection“. This message can be confusing to most people so this blog will look at what PHP throwing the error means, why it happens and how to address the issue.
If you have a web hosting account on a shared server then you might have come across this error message before. If you have come across it, you will know it’s a big headache. Here is what you need to do if it ever happens to you.
Table of Contents
How to resolve when user already has more than ‘max_user_connections’ active connection
Recently, I noticed that I had a lot more than the usual share of queries from Word Press. It was not unusual to have more queries than usual, but the PHP error was something new. The error was something like, “Sorry, but MySQL server has gone away”. This was the error that I was getting quite often.
This issue bothered me for quite some time. I didn’t know how to resolve it. Even after checking the MySQL error log, I could not find any clue. I started looking at the query log of the database and found that a query was taking more than 6 seconds. Resolving seems to be a common problem, because you see it everywhere on the Internet. And the solution is usually: go and raise your max connections