GeoIPAutoUpdater: Encountered PHP error when testing newly downloaded GeoIP database

Hi, we see an error during archiving when downloading Maxmind GEOIP. Can you advise?

INFO [2019-01-18 16:35:49] 11678 SCHEDULED TASKS
INFO [2019-01-18 16:35:49] 11678 Starting Scheduled tasks…
INFO [2019-01-18 16:35:49] 11678 Scheduler: executing task Piwik\Plugins\UserCountry\GeoIPAutoUpdater.update…
INFO [2019-01-18 16:35:49] 11678 GeoIPAutoUpdater: successfully downloaded ‘http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
INFO [2019-01-18 16:35:49] 11678 GeoIPAutoUpdater: Encountered PHP error when testing newly downloaded GeoIP database: 8: Undefined offset: -16776960 on line 1705 of /var/www/html/libs/MaxMindGeoIP/geoip.inc.
ERROR [2019-01-18 16:35:49] 11678 /var/www/html/plugins/UserCountry/GeoIPAutoUpdater.php(167): GeoIPAutoUpdater: failed to unzip ‘/var/www/html/misc/GeoIPCity.dat.dat.gz’ after downloading ‘http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz’: The downloaded file is not a valid GeoIP database. Please re-check the URL or download the file manually.
#0 /var/www/html/plugins/UserCountry/GeoIPAutoUpdater.php(102): Piwik\Plugins\UserCountry\GeoIPAutoUpdater->downloadFile(‘loc’, ‘http://geolite…’)
#1 [internal function]: Piwik\Plugins\UserCountry\GeoIPAutoUpdater->update(NULL)
#2 /var/www/html/core/Scheduler/Scheduler.php(246): call_user_func(Array, NULL)
#3 /var/www/html/core/Scheduler/Scheduler.php(136): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Plugins\UserCountry\GeoIPAutoUpdater))
#4 /var/www/html/plugins/CoreAdminHome/API.php(58): Piwik\Scheduler\Scheduler->run()
#5 /var/www/html/core/CronArchive.php(612): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#6 /var/www/html/core/CronArchive.php(317): Piwik\CronArchive->runScheduledTasks()
#7 /var/www/html/core/Access.php(597): Piwik\CronArchive->Piwik{closure}()
#8 /var/www/html/core/CronArchive.php(319): Piwik\Access::doAsSuperUser(Object(Closure))
#9 /var/www/html/plugins/CoreConsole/Commands/CoreArchiver.php(27): Piwik\CronArchive->main()
#10 /var/www/html/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))
#11 /var/www/html/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))
#12 /var/www/html/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))
#13 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/core/Console.php(90): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/core/Access.php(597): Piwik\Console->Piwik{closure}()
#16 /var/www/html/core/Console.php(91): Piwik\Access::doAsSuperUser(Object(Closure))
#17 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/console(27): Symfony\Component\Console\Application->run()
#19 {main}
INFO [2019-01-18 16:35:49] 11678 Scheduler: finished. Time elapsed: 0.049s
INFO [2019-01-18 16:35:49] 11678 done

Hi,

You are still using the legacy GeoIP plugin. But Maxmind has recently stopped providing these databases and therefore the download fails.

The easiest solution is to switch to GeoIP2 (which is supported since a few Matomo versions). Just enable the GeoIP2 plugin in the plugin list. Keep in mind that the upgrade afterwards can take a loing time and maybe should be run from the commandline so it doesn’t time out.

The next Matomo release will update the old plugin so that there isn’t an error anymore (It just stops downloading the databases )

Is there a free option with Maxmind & Geoip2?

Hi,

Yes, there is still a free Maxmind GeoIP2 database and Matomo can use and update it as before.