@cerlestes opened this Issue on February 26th 2016


/libs/MaxMindGeoIP/geoip.inc isn't checking whether all functions that it implements in the geoip_* namespace already exist. This can lead to fatal errors in Piwik when a non-default version of geoip.so is installed on the server.


Every geoip_* function defined in this file should be surrounded by a check for existence, like some of them already have them.

if (!function_exists('geoip_xxx')) {


We've recently upgraded our production environment to PHP7, using Ondřej Surý's excellent PPA for PHP7 in Ubuntu. But as the official geoip extension hasn't been ported to PHP7 yet, we had to compile some fork that has this support enabled. The best choice seemed to be @Zakays fork (https://github.com/Zakay/geoip) and it worked fine for our needs. This extension also implements some functions in the geoip_* namespace that aren't available in the default PHP5 extension, but are defined in the aforementioned geoip.inc file, which leads to an error like:

PHP Fatal error:  Cannot redeclare geoip_country_code_by_addr() in /var/www/piwik/libs/MaxMindGeoIP/geoip.inc
@tsteur commented on February 26th 2016 Member

Good point, I think it's already done for many functions but possibly not for all that are needed. Can you maybe add a if (!function_exists('geoip_country_code_by_addr')) { ... } around the function and see if more functions need such a check? A pull request could be really helpful.

@tsteur commented on February 26th 2016 Member

refs #8689

@mattab commented on March 31st 2016 Member

Hi @cerlestes - it would be awesome if you can create a pull request to solve this issue :+1:

@Josua2012 commented on July 12th 2017

We are in July 2017. When will this problem be solved? :(

@sgiehl commented on May 10th 2021 Member

This shouldn't be an issue anymore as we switched to GeoIP2 and /libs/MaxMindGeoIP/geoip.inc isn't used any longer.

This Issue was closed on May 10th 2021
Powered by GitHub Issue Mirror