Not able to use GeoIP PECL location provider


#1

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


(Fabian Becker) #2

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


#3

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.


(Fabian Becker) #4

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


#5

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


(Fabian Becker) #6

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


#7

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.


#8

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.