I'm running OpenCart 3.0.4.0 on PHP 8.3 on shared hosting, and I'm encountering an issue with hitting the **max\_user\_connections** limit on my MySQL database. This error occurs around once a day, regardless of the time of day.
### Error Log:
```
[08-Jul-2025 17:00:02 UTC] PHP Fatal error: Uncaught Exception: Error: Could not connect to the database.<br>Error No: 1203<br>Message: User pattayak_newXXX already has more than 'max_user_connections' active connections in /home/pattayak/public_html/system/library/db/mysqli.php:13
Stack trace:
#0 /home/pattayak/storage3040/modification/system/library/db.php(36): DB\MySQLi->__construct()
#1 /home/pattayak/public_html/system/framework.php(83): DB->__construct()
#2 /home/pattayak/public_html/system/startup.php(104): require_once('/home/pattayak/...')
#3 /home/pattayak/public_html/index.php(19): start()
#4 {main}
thrown in /home/pattayak/public_html/system/library/db/mysqli.php on line 13
```
### Site and Hosting Details:
* **Traffic**: Around 100 visitors per day.
* **Installed Modules**: 20 modules.
* **Cron Jobs**: 5 cron jobs (non-overlapping, scheduled at different times).
* **Hosting**: Shared hosting with a 20 DB connection limit.
### Actions Taken:
1. Optimized cron jobs to ensure they don't overlap.
2. Considered changing session storage from database to file-based to reduce database load. I've read that this can potentially reduce connections by 50-60%. Is this true?
3. I'm currently running the site with fairly light traffic, so I'm not sure why it's hitting the DB connection limit.
### Question:
Is upgrading to a VPS the only solution, or is there another way to reduce the database connections without moving to a VPS? For example, will switching to file-based sessions make a significant difference?
I would appreciate any insights or suggestions on how to resolve this issue.
Thanks in advance for your help!
2. Maybe a link to your site - Themes and extensions could be an issue.
3. Have you looked into different hosting?
4. Try a session debloater like this one for example https://www.opencart.com/index.php?rout ... n_id=38580
You really should not be hitting your limit - that is a sign something is wrong.
I would consider a different host before VPS, but it is difficult to know without at least a link.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
You need hosting with higher limits.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Try installing Cidram first. It will block a lot of undesirable traffic and help take the load off of your site.mandom wrote: ↑Wed Jul 09, 2025 5:27 pmHi everyone,
I'm running OpenCart 3.0.4.0 on PHP 8.3 on shared hosting, and I'm encountering an issue with hitting the **max\_user\_connections** limit on my MySQL database. This error occurs around once a day, regardless of the time of day.
### Error Log:
```
[08-Jul-2025 17:00:02 UTC] PHP Fatal error: Uncaught Exception: Error: Could not connect to the database.<br>Error No: 1203<br>Message: User pattayak_newXXX already has more than 'max_user_connections' active connections in /home/pattayak/public_html/system/library/db/mysqli.php:13
Stack trace:
#0 /home/pattayak/storage3040/modification/system/library/db.php(36): DB\MySQLi->__construct()
#1 /home/pattayak/public_html/system/framework.php(83): DB->__construct()
#2 /home/pattayak/public_html/system/startup.php(104): require_once('/home/pattayak/...')
#3 /home/pattayak/public_html/index.php(19): start()
#4 {main}
thrown in /home/pattayak/public_html/system/library/db/mysqli.php on line 13
```
### Site and Hosting Details:
* **Traffic**: Around 100 visitors per day.
* **Installed Modules**: 20 modules.
* **Cron Jobs**: 5 cron jobs (non-overlapping, scheduled at different times).
* **Hosting**: Shared hosting with a 20 DB connection limit.
### Actions Taken:
1. Optimized cron jobs to ensure they don't overlap.
2. Considered changing session storage from database to file-based to reduce database load. I've read that this can potentially reduce connections by 50-60%. Is this true?
3. I'm currently running the site with fairly light traffic, so I'm not sure why it's hitting the DB connection limit.
### Question:
Is upgrading to a VPS the only solution, or is there another way to reduce the database connections without moving to a VPS? For example, will switching to file-based sessions make a significant difference?
I would appreciate any insights or suggestions on how to resolve this issue.
Thanks in advance for your help!
https://github.com/CIDRAM/CIDRAM
Also as Paul says you need to look at better hosting.
Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk
by mona wrote: ↑Wed Jul 09, 2025 5:58 pm1. If you have category count on - turn it off in settings and see if that helps.
2. Maybe a link to your site - Themes and extensions could be an issue.
3. Have you looked into different hosting?
4. Try a session debloater like this one for example https://www.opencart.com/index.php?rout ... n_id=38580
You really should not be hitting your limit - that is a sign something is wrong.
I would consider a different host before VPS, but it is difficult to know without at least a link.
Forgot to tell im using journal 3 theme
So for nr
1. I dont have many products about 40 products and 8 categorues this should not be a isssue.
2. Maybe a link to your site - Themes and extensions could be an issue. You mean External link? Not sure here.
3. Yes i have talked with many hosting. but they al have same on shared hosting. 20-30db connections limit. Siteground offer 500 DB connections on share server but then they its shared on al users.. and there first year is good price 8 usd per month then next year 49usd. so fishy . i dont want setup everyting again and then move server. so many setttings
4. 4. Try a session debloater like this one for example https://www.opencart.com/index.php?rout ... n_id=38580
this module is up to 3.0.3.7.. ------ 3 .0.3.8 and up this issue is fixed they say. so no need to use this.
i mean my site does not have so much traffic so i need VPS server .. just that DB connection hit userlimit some time. this really sucks.
What about changing Session to file instead of DB? in config.php. will this lower my DB connections?
This could definitely be causing you an issue.
Turn it off
A link to your website.
If you host is not giving you access - change hosts
Not all hosts are the same even if the "figures" look better or worse.
Say a boat is taking in water. You need a pump, but you are asking if using a thimble will reduce the water level - yes, but it wont stop the boat from sinking !
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
The web access logs. In cPanel it's under Metrics as Raw Access.
Changing the session to file instead of db won't save a connections to the database as the request will still connect to the database for settings, etc. However if it was quicker then it may help as the connections will free up sooner, but it could also be slower.
I found the issue!! thanks.. after checking logs.mandom wrote: ↑Wed Jul 09, 2025 6:23 pmWhat accses log are you refering to? Server level log? i dont have accses to that.ADD Creative wrote: ↑Wed Jul 09, 2025 6:10 pmCheck your access log around the time of the errors to see what sort of requests you are receiving.
Tawkto chat widget is using Ai function to scan the hole site exakt same time. Creating 50-100 DB connectiojns same minut.. talking to there support now.
problem solved thank man!!
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Users browsing this forum: No registered users and 18 guests