MaxMind provides an optional C extension that is a drop-in replacement for MaxMind\Db\Reader. This will speed up the location lookups for GeoIp2 PHP provider enormously and is recommended for high traffic instances.

Installing libmaxminddb

The PHP extension requires the C library libmaxminddb for reading MaxmindDB files. To install the library you need to download it’s latest tar ball and extract it, or clone their git repository

git clone --recursive https://github.com/maxmind/libmaxminddb

To install it, run the following commands:

$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

Note: When cloning from git, run ./bootstrap from the libmaxminddb directory and then run the commands above.

You can find more details about installing the library in their README

Installing Extension

After successfully installing libmaxmindb, you need to download or checkout MaxMind-DB-Reader-php.
Then run the following commands from the top-level directory of this distribution:

cd ext
phpize
./configure
make
sudo make install

You then must load your extension. The recommend method is to add the following to your php.ini file:

extension=maxminddb.so

Now restart the webserver and the GeoIP 2 PHP provider should mention if the extension is loaded in Matomo (Piwik) > Settings > Geolocation.

Note: You may need to install the PHP development package on your OS such as php5-dev for Debian-based systems or php-devel for RedHat/Fedora-based ones.

Any questions?

Many answers and more information about Matomo you can find here:

We are social

Follow us: