# User epiz\_23862135 already has more than 'max\_user\_connections' active connections

**URL:** https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312
**Category:** Hosting Support
**Created:** [December 28, 2022, 9:47pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312 "2022-12-28T21:47:50Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 28, 2022, 9:47pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/1 "2022-12-28T21:47:50Z")

</div>

**User epiz\_23862135**

**Error:** User epiz\_23862135 already has more than ‘max\_user\_connections’ active connections

Most of my scripts are showing this error, but I believe no other user is online as of now. Please help me out ASAP, the System is being tested with real data.

The homepage is actually ok, but after logging in to [mysquavero.ga](https://mysquavero.ga) account, that error comes up. but few minutes ago, it was working properly. Please help me out!

---

<div class="post-metadata">

### Author: ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)
#### Post date: [December 28, 2022, 10:02pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/2 "2022-12-28T22:02:03Z")

</div>

See:

> [@How to fix max\_user\_connections problem](https://forum.infinityfree.com/t/how-to-fix-max-user-connections-problem/16247/3):
>
> The “max\_user\_connections” limit it set to prevent a single account from creating a ton of connections to the database and overloading the server, causing problems for everyone else. Increasing the maximum number of connections would be the easy solution. But unless you host your own database server, you can’t change that limit. Note that this is a MySQL restrictions, not a PHP restriction. Instead, there are some other things you could try: If you have multiple websites on the same account,…

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 28, 2022, 10:06pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/3 "2022-12-28T22:06:09Z")

</div>

I’ve read that, but it was working just a few hours ago. Am trying to put a destructor to the php scripts that are bringing that error to close connections

---

<div class="post-metadata">

### Author: ![wackyblackie](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/wackyblackie/32/43350_2.png) [@wackyblackie](https://forum.infinityfree.com/u/wackyblackie)
#### Post date: [December 28, 2022, 10:09pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/4 "2022-12-28T22:09:17Z")

</div>

Can you try reusing a connection? That way you won’t have to keep opening different connections.

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 28, 2022, 10:27pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/5 "2022-12-28T22:27:37Z")

</div>

Still not working

---

<div class="post-metadata">

### Author: ![wackyblackie](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/wackyblackie/32/43350_2.png) [@wackyblackie](https://forum.infinityfree.com/u/wackyblackie)
#### Post date: [December 28, 2022, 10:34pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/6 "2022-12-28T22:34:53Z")

</div>

How so? You say “not working” but provide no detail… is the connection already closed? is the query not working?

Did you enable `display_errors`?

I assume you’re trying to run SQL queries through a home-grown php class function. In my past experience, I had trouble just running queries themselves.

If you need some help, do you mind elaborating a bit?

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 28, 2022, 10:58pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/7 "2022-12-28T22:58:39Z")

</div>

I have over 4 classes, php scripts that write up my page, they all fetch data from the database. This is their basic mark up

```auto
<?php

class className{
           private $db_one;
           private $db_two;
           //Other Variables
           public function __construct()
           {
                  $this->db_one=mysqli_connect('a','b','c','d');
                  $this->db_two=mysqli_connect('a','b','c','e');
           }
           public function __destruct()
           {
                  mysqli_close($this->db_one);
                  mysqli_close($this->db_two);
           }
           //Other methods that might be calling these db_variables
}

```

I wasnt doing this before, I’ve edited to this after coming across this error.

---

<div class="post-metadata">

### Author: ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)
#### Post date: [December 29, 2022, 9:13am UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/8 "2022-12-29T09:13:04Z")

</div>

The issue you’re experiencing, as well as the code that’s generating it, is quite similar to a case from a month ago.

> [@I'm still confused on how to solve 'max\_user\_connections' problem](https://forum.infinityfree.com/t/im-still-confused-on-how-to-solve-max-user-connections-problem/68657/2):
>
> Thank you for the elaborate post! All the information you’ve provided really helps paint a clear picture for me as to what’s going on. Also, you seem to have a pretty good understanding of what’s going on, which helps a lot. I think I agree with the StackOverflow post you found. I didn’t know about the persistent option before, but it seems like it keeps the database connection alive even after the request ends. If I understand correctly how this option is implemented and works with Apache (c…

The issue is that with your code structured like this, every object instance creates it’s own database connection. And in the example, it even creates two connection for a single class! So if you instantiate, say, five different objects, this can result in 5 (10?) database connections for a single requests, which makes it very easy to hit the connection limit.

The right way to fix this is to only create one database connection per request and use that across all objects and classes. There are few different patterns you can use for this, but the Singleton Pattern (which I explained in that other post) is effective and simple to implement.

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 30, 2022, 2:55pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/9 "2022-12-30T14:55:42Z")

</div>

Can’t I come across this problem when I move to premium hosting?

---

<div class="post-metadata">

### Author: ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)
#### Post date: [December 30, 2022, 3:20pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/10 "2022-12-30T15:20:48Z")

</div>

The problem will be the same no matter where you host your site. And it will get worse as your site gets more popular.

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 30, 2022, 5:38pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/11 "2022-12-30T17:38:47Z")

</div>

Correct me if am wrong. The solution to this problem is to open and close the database for each query right?

---

<div class="post-metadata">

### Author: ![EdwinTigor](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/edwintigor/32/28150_2.png) [@EdwinTigor](https://forum.infinityfree.com/u/EdwinTigor)
#### Post date: [December 30, 2022, 5:44pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/12 "2022-12-30T17:44:12Z")

</div>

> [@Godson](#):
>
> Correct me. The solution to this problem is to open and close the database for each query right?

Yes, if you dont want to close you can add much user to db.  
And loop possibility connection with try except.

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 30, 2022, 5:54pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/13 "2022-12-30T17:54:57Z")

</div>

How should I add users? Not that I don’t know how to, but I find it kinda a little different with creating users on a local server at home.

Please give me an example. Whether to hard code it or do it in Control Panel.

---

<div class="post-metadata">

### Author: ![EdwinTigor](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/edwintigor/32/28150_2.png) [@EdwinTigor](https://forum.infinityfree.com/u/EdwinTigor)
#### Post date: [December 30, 2022, 6:02pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/14 "2022-12-30T18:02:33Z")

</div>

Why don’t try option 1.

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 30, 2022, 6:03pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/15 "2022-12-30T18:03:38Z")

</div>

Adding users to infinity free account is impossible

---

<div class="post-metadata">

### Author: ![wackyblackie](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/wackyblackie/32/43350_2.png) [@wackyblackie](https://forum.infinityfree.com/u/wackyblackie)
#### Post date: [December 30, 2022, 6:04pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/16 "2022-12-30T18:04:08Z")

</div>

I think I’ll try to clear this up a little bit.

> [@Godson](#):
>
> The solution to this problem is to open and close the database for each query right?

No. The solution is the exact opposite. Keep the connection open and then close it only when you are done making queries.

> [@EdwinTigor](#):
>
> you can add much user to db

In free hosting, your database only gets one user, the epiz\_xxxxxxxx account name you were assigned when you created the account.

> [@Godson](#):
>
> How should I add users? Not that I don’t know how to, but I find it kinda a little different with creating users on a local server at home.

Read what I wrote above in this post. You can’t add users, and yes we have a modified phpMyAdmin installation, so it will be different from your local server.

> [@Godson](#):
>
> Please give me an example. Whether to hard code it or do it in Control Panel.

Of course! But what do you need an example of? We can try to help you to the best of our abilities, but that’s hard when we don’t know exactly what to help you with.

> [@EdwinTigor](#):
>
> Why don’t try option 1.

Again, you can’t add a user here. You have one, that’s enough, and that’s all you’ll get.

> [@Godson](#):
>
> Adding users to infinity free account is impossible

Yes, good observation.

---

<div class="post-metadata">

### Author: ![EdwinTigor](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/edwintigor/32/28150_2.png) [@EdwinTigor](https://forum.infinityfree.com/u/EdwinTigor)
#### Post date: [December 30, 2022, 6:07pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/17 "2022-12-30T18:07:04Z")

</div>

> [@Godson](#):
>
> Adding users to infinity free account is impossible

You can use, sqlite queue trick, if really no options work. But hard to do.  
use sqlite to secondary recording to reduce traffic. lol. 😄

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 30, 2022, 6:15pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/18 "2022-12-30T18:15:11Z")

</div>

Am dead 😭

---

<div class="post-metadata">

### Author: ![Godson](https://forum.infinityfree.com/letter_avatar/godson/32/5_5575768a8748004e209b776fc1b2916d.png) [@Godson](https://forum.infinityfree.com/u/Godson)
#### Post date: [December 30, 2022, 6:17pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/19 "2022-12-30T18:17:31Z")

</div>

There is no one else accessing my site right now, why should it keep showing that error? Unless someone has connected to exhaust my user connection limit, could you please check that for me?

---

<div class="post-metadata">

### Author: ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)
#### Post date: [December 30, 2022, 7:42pm UTC](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312/20 "2022-12-30T19:42:19Z")

</div>

> [@Godson](#):
>
> why should it keep showing that error?

Because the code that is running on your site is causing that to happen when there is one visitor, you.

To fix this, please see the post from Admin above.

[Next page](https://forum.infinityfree.com/t/user-epiz-23862135-already-has-more-than-max-user-connections-active-connections/70312.md?page=2)
