Database issue

Hey!

So my website is here: Garrasi (rf.gd)

And the issue is that when I do log in, sometimes it tells me this error from the infinityfree database, but I don’t understand it, may I please know what does that mean and how to fix it?

On XAMPP there are not such issues. and the variable is 151 for max user connections and it is 200 on mine, so it’s way enough

Thanks!

Read these?

https://forum.infinityfree.com/search?q=max%20user%20connection

This is free hosting. Therefore limits do apply. If you need more, upgrade to premium hosting

4 Likes

The space given by infinity free is way enough, the variable max users is 200 on infinity free but for 151 on localhost it works so I think the issue is from somewhere else

I found more details

and those 2 ones "Warning: PDO::prepare(): SQLSTATE[00000]: No error: PDO constructor was not called in /home/vol1_8/epizy.com/epiz_33369697/htdocs/classes/PostManager.class.php on line 30

Fatal error: Uncaught Error: Call to a member function execute() on null in /home/vol1_8/epizy.com/epiz_33369697/htdocs/classes/PostManager.class.php:31 Stack trace: #0 /home/vol1_8/epizy.com/epiz_33369697/htdocs/index_logged.php(107): PostManager->listPost() #1 {main} thrown in /home/vol1_8/epizy.com/epiz_33369697/htdocs/classes/PostManager.class.php on line 31"

The comment part was fixed, but the error below is still relevant, thing is that I have no clue on how to fix it

The limit for max_user_connections on InfinityFree is only 4. This should be plenty for most websites, assuming your code only opens one database connection per request, and closes them when done.

I took a quick look at your code, and the general setup seems to be put quite well together, and you already have a single database connection being passed around, so that’s good!

In the database setup code, you do appear to have one particular option enabled that’s causing all of your problems: persistent MySQL connections.

This option doesn’t work well on our hosting, and may not work at all. In very specific server setups (if you have your own server with PHP-FPM for example), it can work, but on a shared server that’s set up the way we’ve set up our hosting, enabling Persistent Connections just results in a large number of connections that are open simultaneously but cannot be used by your application.

Here is another topic from some time ago where someone else had a similar problem with persistent connections:

For you, the solution is much simpler though, no need to refactor your code. All you need to do is disable MySQL Persistent Connections and you shouldn’t ever see this error again.

5 Likes

Would that mean I need to use another server other than infinityfree?

No, did you read Admins reply?

All you need to do is disable MySQL Persistent Connections and you shouldn’t ever see this error again.

6 Likes

I did read the reply, and I thought I needed to take another server and then disable this option, which I found contradictory, hence why I wondered.

Back to the point, may I please know how can it be disabled please?

I found out, and now it works, thanks!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.