Server gone away

I’m on a shared server and have setup and running successfully for over a week now (Matomo 4.x). I have used all the solutions I’m able to from this thread, and still getting emails every hour about the server going away. I set the cronjob to run hourly, and received more emails. I have made the cronjob now run every 12 minutes, and I still get the email every hour. Here is my crontab:

*/12 * * * * /usr/local/bin/php /home/rusername/directory/console core:archive --url=https://statistics.mywebpage.com/ > /dev/null

I cleaned it to remove my username etc. Here is the email I get hourly with the error.

ERROR [2021-04-22 18:12:48] 1983230  /home/username/statistics.webpage/libs/Zend/Db/Statement/Mysqli.php(77): Mysqli prepare error: MySQL server has gone away
Mysqli prepare error: MySQL server has gone away
#0 /home/username/statistics.webpage/libs/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('UPDATE `mtnv_op...')
#1 /home/username/statistics.webpage/libs/Zend/Db/Adapter/Mysqli.php(419): Zend_Db_Statement->__construct(Object(Piwik\Db\Adapter\Mysqli), 'UPDATE `mtnv_op...')
#2 /home/username/statistics.webpage/libs/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('UPDATE `mtnv_op...')
#3 /home/username/statistics.webpage/core/Db.php(276): Zend_Db_Adapter_Abstract->query('UPDATE `mtnv_op...', Array)
#4 /home/username/statistics.webpage/core/Option.php(198): Piwik\Db::query('UPDATE `mtnv_op...', Array)
#5 /home/username/statistics.webpage/core/Option.php(74): Piwik\Option->setValue('geoip2.loc_db_u...', 'https://downloa...', 0)
#6 /home/username/statistics.webpage/plugins/GeoIp2/GeoIP2AutoUpdater.php(875): Piwik\Option::set('geoip2.loc_db_u...', 'https://downloa...')
#7 /home/username/statistics.webpage/plugins/GeoIp2/GeoIP2AutoUpdater.php(106): Piwik\Plugins\GeoIp2\GeoIP2AutoUpdater->updateDbIpUrlOption('geoip2.loc_db_u...')
#8 [internal function]: Piwik\Plugins\GeoIp2\GeoIP2AutoUpdater->update(NULL)
#9 /home/username/statistics.webpage/core/Scheduler/Scheduler.php(266): call_user_func(Array, NULL)
#10 /home/username/statistics.webpage/core/Scheduler/Scheduler.php(138): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Plugins\GeoIp2\GeoIP2AutoUpdater))
#11 /home/username/statistics.webpage/plugins/CoreAdminHome/API.php(69): Piwik\Scheduler\Scheduler->run()
#12 /home/username/statistics.webpage/core/CronArchive.php(627): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#13 /home/username/statistics.webpage/core/CronArchive.php(263): Piwik\CronArchive->runScheduledTasks()
#14 /home/username/statistics.webpage/core/Access.php(664): Piwik\CronArchive->Piwik\{closure}()
#15 /home/username/statistics.webpage/core/CronArchive.php(268): Piwik\Access::doAsSuperUser(Object(Closure))
#16 /home/username/statistics.webpage/plugins/CoreConsole/Commands/CoreArchiver.php(27): Piwik\CronArchive->main()
#17 /home/username/statistics.webpage/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /home/username/statistics.webpage/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /home/username/statistics.webpage/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /home/username/statistics.webpage/core/Console.php(130): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /home/username/statistics.webpage/core/Access.php(673): Piwik\Console->Piwik\{closure}()
#23 /home/username/statistics.webpage/core/Console.php(131): Piwik\Access::doAsSuperUser(Object(Closure))
#24 /home/username/statistics.webpage/core/Console.php(82): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/username/statistics.webpage/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/username/statistics.webpage/console(32): Symfony\Component\Console\Application->run()
#27 {main}
ERROR [2021-04-22 18:12:48] 1983230  Uncaught exception: /home/username/statistics.webpage/libs/Zend/Db/Statement/Mysqli.php(77): Mysqli prepare error: MySQL server has gone away
Mysqli prepare error: MySQL server has gone away

My PHP.ini file:

allow_url_fopen = Off
display_errors = Off
enable_dl = Off
file_uploads = On
max_execution_time = 120
max_input_time = 120
max_input_vars = 1000
memory_limit = 64M
post_max_size = 16M
session.gc_maxlifetime = 2880
session.save_path = "/var/cpanel/php/sessions/ea-php74"
upload_max_filesize = 8M
zlib.output_compression = Off
mysqli.reconnect = On
mysqlnd.net_read_timeout = 315360000
wait_time = 1800

Any help would greatly be appreciated.

Lastly, one of my 2 web pages being tracked, does have from 70-140+ unique visitors per day. So I guess that is high traffic? I really don’t know what the standard is.

Hi Shane, what MariaDB / MySQL distribution are you using?

When I checked on my cpanel, it shows it as a MySQL database. I honestly am not sure how to check other than that.

While scrolling through the Matomo Settings and diagnostics page, I found this line:

MySQL Version	10.2.37-MariaDB-log

So, I’m not sure what that means.

I’m still getting the emails, though Matomo seems to be working great. I may filter all the emails to the trash. They are that annoying.