Post by mandom » Thu Jul 24, 2025 9:21 am

Issue resolved! Custom Module was poorly coded, causing a connection to the database with every visitor."

New member

Posts

Joined
Tue Jun 30, 2015 4:44 pm

Post by mandom » Thu Jul 24, 2025 9:22 am

mandom wrote:
Wed Jul 09, 2025 5:27 pm
Hi 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!

Issue resolved! Custom Module was poorly coded, causing a connection to the database with every visitor."

New member

Posts

Joined
Tue Jun 30, 2015 4:44 pm

Post by paulfeakins » Fri Jul 25, 2025 7:42 pm

mandom wrote:
Thu Jul 24, 2025 9:22 am
Issue resolved! Custom Module was poorly coded, causing a connection to the database with every visitor."
Out of interest, what module was it so we can avoid it in future?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: OSWorX, Semrush [Bot] and 22 guests