Can't log in: "MySQL server has gone away"

Matt V 4 years ago updated by Vlad R 4 years ago 5

Hi Vlad,

Hoping this is a simple issue. I made some recent changes to my DNS and suddenly I'm having trouble logging in to my Filerun. The only error I can find is in my Apache log:

[Sun May 05 17:25:14.493088 2019] [proxy_fcgi:error] [pid 644:tid 140284033758976] [client XXX.XXX.XXX:55888] AH01071: Got error 'PHP message: PHP Warning: PDO::query(): MySQL server has gone away in /var/www/html/system/classes/vendor/FileRun/Utils/DB.php on line 32\nPHP message: PHP Warning: PDO::query(): Error reading result set's header in /var/www/html/system/classes/vendor/FileRun/Utils/DB.php on line 32\nPHP message: PHP Fatal error: Uncaught Error: Call to a member function rowCount() on null in /var/www/html/system/classes/vendor/FileRun/Utils/DP.php:40\nStack trace:\n#0 /var/www/html/system/classes/vendor/FileRun/Notifications/Run.php(474): FileRun\\Utils\\DP->delete(Array)\n#1 /var/www/html/system/classes/vendor/FileRun/Notifications/Run.php(433): FileRun\\Notifications\\Run::addToLog(Array, '

I was able to solve this issue!! Oh wow it was definitely a tough one to track down though.

I changed settings on on my DNS server so it broke the address to my SMTP server which is tied to filerun (for the notifications). Apparently if you change the domain name it will break filerun and not give any obvious hints in any of the log files other than that the database connection has "gone away".

OK, but how did you solve that? I changed the host name and the DNS settings too, now I'm unable to update the system.

I think your issue of not being able to update is probably a different issue from mine. However I have had issues with updating before and I may be able to assist. Post your error log upon trying to update below. In the meantime, you might want to visit https://docs.filerun.com/updating.

My issue was that I was entirely unable to sign in to Filerun. I could get to the Filerun sign-in page just fine, but when I entered my username and password, the page would time out with a 504 error. The issue began when I changed DNS settings at the registrar. What made the issue tough to solve was that changing DNS settings at the registrar seemed so incredibly unrelated to not being able to sign in to Filerun. Anyway, the basic steps to reproduce my issue would be:

1. Under control panel->email->settings, set up a SMTP server to send out your email notifications. For example:

2. At your registrar, change "example.com" to point to a different IP address than your mail server, thereby "breaking" your mail server. (Sounds ridiculous, but I was migrating my mailserver from server A to server B, and was planning to come back and fix it).

This will break Filerun for some reason. My theory is because Filerun notifications are so MySQL dependent, it will try to send a SMTP notification by quering the DB, which won't work because you have made changes to your mailserver hostname. Filerun might keep trying to make SQL queries to send the notification, which will cause max_queries limit to be reached. When this happens, Filerun can no longer query the DB to allow users to login.

The fix: Log in to PHPMyAdmin (or database editor of your choice) and manually edit your Filerun database table df_settings->smtp_host to point to the correct SMTP server hostname (or IP address).


That is indeed a pretty close explanation. Some MySQL servers don't allow a client (in this case PHP/FileRun) to be connected without doing anything (without running any queries) for too long (yes, even if it's just for a few seconds).

So when logging in, FileRun connects to the MySQL server, and performs the authentication, then because of the notifications settings, it is trying to send out some e-mails, trying to communicate with an inaccessible e-mail server (due to DNS issues), dragging things for too long before trying to communicate again with the MySQL server, which in the meantime it already dropped the client's connection, resulting in the error which prevents the login flow.

Makes sense, thank you for taking the time to explain that. For your debugging purposes, my my.cnf file was set to the default settings of:




Thanks again, Vlad.