PHP Version change causes "server gone away" error

Server change from PHP 7.1 to 7.3. After the change, I started receiving this cron job error:

ERROR [2020-04-18 16:29:04] 2491262 Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last3&format=php&trigger=archivephp. Response was ‘a:2:{s:6:“result”;s:5:“error”;s:7:“message”;s:48:“Mysqli prepare error: MySQL server has gone away”;}’
ERROR [2020-04-18 16:29:04] 2491262 Empty or invalid response ‘’ for website id 1, Time elapsed: 301.762s, skipping
ERROR [2020-04-18 16:29:04] 2491262 Uncaught exception: /home/domainname/public_html/matomo/libs/Zend/Db/Statement/Mysqli.php(77): Mysqli prepare error: MySQL server has gone away

I’ve checked the other “MySQLi, gone away” postings in the forum. I disabled optimization in config/config.php (and did a manual optimization) and lengthened my timeout to 600. No change.

I can still use the interface, with some limitations. For example, the “city” block on the dashboard doesn’t function, but “visits log” does. No problem gathering tracking stats. Clicking into Adminstration > Diagnostics > System Check gives the same MySQLi error, in the browser. Otherwise can navigate Administration fine and change values.

Error goes away, and functionality returns, if I drop back to 7.1.

Any ideas what I can do to fix? Thanks.

I was able to solve this by going into my PHP module settings. Please keep in mind that I had no idea what I was doing. Under CPanel > Select PHP Version, I changed the selected MYSQL modules on my shared hosting provider.

I received the errors when, under “M”, I had both “mysqli” and “mysqlnd” checked.

I toggled off both "mysql and “mysqlnd” and my WordPress and Matomo installations broke.

I toggled on, under “N”, “nd_mysqli”. It force checked, under “M”, “mysqlnd”. I left “mysqli” unchecked.

Both WordPress and Matomo responded again. All functionality returned to the Matomo dashboard (city block loaded, Admin > Diag worked).

php-settings

1 Like