GUI throws error when enabling firewall

connectivity - firewall - enable firewall, got the below error

Exception thrown with message “SQLSTATE[HY000] [2002] Connection refused::SQLSTATE[HY000] [2002] Connection refused”

#7 Exception in /var/www/html/admin/libraries/utility.functions.php:204
#6 die_freepbx in /var/www/html/admin/libraries/BMO/Database.class.php:142
#5 PDOException in /var/www/html/admin/libraries/BMO/Database.class.php:137
#4 PDO:__construct in /var/www/html/admin/libraries/BMO/Database.class.php:137
#3 FreePBX\Database:__construct in /var/www/html/admin/libraries/BMO/FreePBX.class.php:71
#2 FreePBX:__construct in /var/www/html/admin/bootstrap.php:153
#1 require_once in /etc/freepbx.conf:11
#0 include_once in /var/www/html/admin/config.php:100

see attached full pictures of the error.

PBX Firmware 12.7.5-1805-3.sng7
Firewall 13.0.56

If anyone with more knowledge than me who can please take look at these errors and tell me whats wrong here.
Is this a bug?

Appreciate your responses


Up please.

When I go to the GUI I get the above error with the same stacktrace.

Attached is what I get when logging into SSH.

This is from the GUI, I do notice that the error details is a bit different than my original post

So this seems to me that it’s the firewall which is causing it, can anyone please tell me what to look for?


MySQL is not running - it’s crashed or been stopped. Restart MySQL or reboot your machine.

Once you get MySQL running again, you need to make sure you repair all of the databases.

Repair from the console as root with mysqlcheck --repair --all-databases

IIRC, there’s also an ‘fwconsole repairall’ command, but I might have dreamed that.

This keeps on happening. I have to reboot my PBX every time.

I tried to update framework today, and here’s what happened.

I tried running the database repair command, it says for almost every table the same error.

Anything I can look for?

The error is ‘MySQL Server has gone away’. That means it was running, and now it’s not. At a guess, you’re running out of memory, and MySQL is being killed.

Thanks Rob,

That was my initial thought, the pbx running out of memory.
This pbx is a $5 VM on Vultr 1GB ram. I believe that some users here have the same VM deployed with no issues. I’m not trying to blame it on, but it seems to me that this issue only happens when the pbx firewall is running. Is there any way I can troubleshoot that?

CentOS 7 says 2GB min but 4GB recommended last time I checked.

1 Like

Hi Tony,

I understand that, some users here said that they have $5 instances running just fine. my question is how i can troubleshoot what is actually eating the memory that causes mysql to stop?

if you don’t have any proper monitoring you could always start a screen session and just run

watch -n5 "ps aux >> /tmp/mem && date >> /tmp/mem && printf '\n\n\n' >> /tmp/mem" 

until it happens again

that’s a really lazy solution and will be very verbose but you shouldn’t really miss a thing. at least nothing process metrics-wise.

Just read through the /tmp/mem file it creates until you see something start to eat ram and die

If it’s happening quite suddenly just check your logs for mysql stopping and see if there’s anything happening right before.

also remember to do system updates, not just freepbx updates

if the machine is trying to update itself for some reason while asterisk/ apache/ mysql are running i could see it eating up the resources.

I should remind you that FreePBX has built in monitoring. Right there on the dashboard!


What’s causing it? Could be anything. But the minimum requirements are 2gb. I’d recommend 4, and 2 CPU’s, as the entry-level VM though.

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