GeoIP (PHP)


#1

I notice that your discerption for GeoIP (PHP) says, “It uses a GeoIP database and MaxMind’s PHP API to accurately determine the location of your visitors.” My computer does not have a connection to the outside internet and I was wondering how the code connects to the MaxMind’s API? I have some imports that run slow when the code can’t find the IP address from GeoIp.

Thank you for your time,


#2

The GeoIP database is a binary file that you download from the MaxMind site, re-name, and then copy to the /misc directory of your Piwik installation. The code to use this binary file was adapted from the MaxMind API, and is built into Piwik.

Thus, your Piwik installation doesn’t actually need to connect directly to the MaxMind server. You might want to configure Piwik to not try to update its copy of the MaxMind database automatically. MaxMind releases monthly updates to the database in the first week of every month.

Here’s the download location:
http://dev.maxmind.com/geoip/legacy/geolite/

Download the GeoLite City binary/GZIP file, unzip it, rename the result to GeoIPCity.dat, and then copy that re-named file to the server’s /misc directory in the Piwik install. Of course, you’ll need to activate the PHP method of Geolocation


#3

Thank you for the reply. I have already downloaded the file and I’m able to track where the users have visited from. My problems comes when there is an unknown IP address when I’m importing my log files. If there is an unknown IP address, then the HTML requests just slows down and acts like it is not doing anything. Almost like it is waiting for a Post back request. There is not action on any of my servers showing that any process are running. Once the process times out, the imports resumes as normal.

I guess I’m just trying to find out what could be trying to make an outside my network request and causing the import to slow down.

Thank you for your time,


(Matthieu Aubry) #4

@Spherexx all the possible network things that Piwik connect should be documented in this issue: New setting to disable all outgoing http requests from a Piwik server · Issue #6324 · matomo-org/matomo · GitHub