Not able to use GeoIP PECL location provider

Hi all,

I am using Piwik version 1.11.1. I am not able to use the GeoIP PECL location provider since piwik shows it is not installed. But both PECL and geoip extension are installed.

Actually it was working before. Recently I updated the php version and the piwik version. I am not sure when this stopped working. But I noticed only after updating the piwik version.

By debugging I found out function_exists(‘geoip_db_avail’) in piwik/plugins/UserCountry/LocationProvider/GeoIp returns empty instead of true.

It would be great if anyone could help to resolve this issue.

Thanks,
Ilam

If it returns empty, then this means that the GeoIP extension is not installed for your PHP. Read here on how to reinstall it: PHP: GeoIP - Manual

That’s the problem. It is already installed. When I run pecl install geoip, I get the message that the latest version of geoip is already installed. As I mentioned in my post, it was working before.

Can you check phpinfo()? You said you upgraded PHP - so maybe it’s just not activated for your newer PHP version.

What should I look for? pecl is not found in the results.

Look for an entry called geoip. It should list extension and library version. If it’s not there, then it’s not activated for your PHP installation.

E.g. on Linux you should have the following line in your php.ini:


 extension=geoip.so

mod_geoip is in the loaded modules list. Also extension=geoip.so is in the php.ini along with the geoip.custom_directory entry. This is something I added long time back.

though this is an old thread I’ve found the solution for this.
You have to add


[geoip]
geoip.custom_directory=/path/to/piwik/misc

to /etc/php5/cli/php.ini to make this work.