Pecl GeoIP and archive.php error

I got a GeoIP related problem. The whole archiving goes perfect except for a single error.

Piwik 1.12
PHP 5.3 , memory 512M
GeoIP PECL from GitHub - Zakay/geoip: A more complete fork of PECL MaxMind geoip extension
MySQL 5.5

Apache Error log :
[error] [client 123.45.678.9] PHP Fatal error: Cannot redeclare geoip_country_code_by_addr() in /soft/data/web/stats/piwik/libs/MaxMindGeoIP/geoip.inc on line 523

Log from archive.php Cron job :
ERROR: Got invalid response from API request: http://123.45.678.9/index.php?module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=XXXX&trigger=archivephp. The response was empty.

In fact the empty response is a 500 error.

Any hint ?
Maybe I should comment something in piwik/libs/MaxMindGeoIP/geoip.inc ?

Dali

Piwik is designed to work w/ the GeoIP PECL module located here: http://pecl.php.net/package/geoip[/url], not the one at [url=https://github.com/Zakay/geoip]https://github.com/Zakay/geoip. That one seems to add some missing functions that Piwik is not aware of.

This doesn’t mean you can’t use it, though. In geoip.inc, you can surround the geoip_country_code_by_addr function with the following code:


if (!function_exists('geoip_country_code_by_addr')) {
...
}

and the error will go away. You may have to do this for more than one function depending on exactly what GitHub - Zakay/geoip: A more complete fork of PECL MaxMind geoip extension adds.

Instead of “hacking” around Maxmind code I went back to the original PECL extension and I’m now “error free”.

Thanks for pointing me in the right direction CapedFuzz.

Dali