Geoip stropped after upgrading 1.12 to 2.2.b18


#1

For months Geoip worked on our installation using Geoip PECL with PHP 5.3.13.

After the upgrade from 1.12 to 2.2b18 last Sunday, it ceased to work and reports started to show France instead of Canada.

enable_language_to_country_guess = 0 , was set months ago in config.ini.php. I’ve also re-read the FAQ about GeoIP (How do I get the GeoIP databases to improve accuracy of Country detection, and detect visitors’ Cities and Regions? - Analytics Platform - Matomo)

In Settings=>Geolocation it clearly shows that I’m from France (not true) and my ORG and ISP are Unknown.

It also still says that I’m using the “city” database.

Visitors=> Region and City, reports after the upgrade are both empty.

Nothing changed on the server except for Piwik’s version.

Did something change in GeoIP code from Piwik 1.12 to 2.2 that could have this effect ?

Dali


(Matthieu Aubry) #2

I don’t think anything has changed that could cause this. If you have more info let us know


(Tassoman) #3

Looks like your geographic database is not updated. You could try loading geoip PECL module / apache module.
Then if you run ubuntu you can get geoip-database-contrib package that will download latest updates and put them in /usr/share/GeoIP/*


#4

I just test with minimal code:


<?php
print_r(geoip_record_by_name('www.umontreal.ca'));
?>

And the result is correct: Array ( [continent_code] => NA [country_code] => CA [country_code3] => CAN [country_name] => Canada [region] => QC [city] => Montréal [postal_code] => H3T [latitude] => 45.511501312256 [longitude] => -73.615997314453 [dma_code] => 0 [area_code] => 0 )

So GeoIP on the site is still working.

Could it be because my GeoIP DB isn’t under /piwik/ directory ? My custom directory set in php.ini is: /var/lib/GeoIP/ and not updated automatically ?

Dali


(Tassoman) #5

My installation is configured with GeoIP PECL and Piwik admin interface doesn’t ask for any location. Just works flawless.
Silly question: did you restarted apache?


#6

Yes Apache was restarted. Gracefully and even a not-so-nice stop then start…

My next step is to upgrde the DB and put it where a “normal” Piwik would put it.

Dali


(Tassoman) #7

I suppose another try could be “downgrading” GeoIP configuration to Piwik libraries then trying a libraries update


#8

There is a FAQ about this issue: How to - Analytics Platform - Matomo

Did it worked?


#9

Still not working after reading more FAQ you can’t think of…

What I did this afternoon:

[ul]
[li] New DB from MaxMind
[/li][li] Renamed GeoIPCity.dat
[/li][li] Check right and put it in the “official” piwik/misc/ directory
[/li][/ul]

I also change from GeoIP (PECL) to GeoIP (php) as a test.

Without success.

The Geolocation page has those infos/messages:

According to this provider, your current location is: France (no, should be Canada but my browser is sending fr-ca)
Org: Unknown
ISP: Unknown

Note: This GeoIP implementation has access to the following types of databases: City

Piwik cannot find any GeoIP $_SERVER variables.

I tried “pure=PHP” script :


<?php
$client     = $_SERVER['HTTP_CLIENT_IP'];
$forward    = $_SERVER['HTTP_X_FORWARDED_FOR'];
$remote     = $_SERVER['REMOTE_ADDR'];
$forwardfor = $_SERVER['HTTP_FORWARDED'];

echo "client: $client | forward: $forward | remote: $remote | forward_for: $forwardfor <hr>"   ;
?>

And got only a value for $remote.

My Pwik server is behind proxy, but it worked for many months… I’m getting discouraged.

Dali