Support » Plugin: Wp-Insert - Adsense / Ad Management Plugin » GeoIP: Cannot redeclare geoip_country_code_by_name()

  • Resolved infernet


    I need to run piwik on the same server where I host my wordpress portal.
    I am running ubuntu 13.04, thus I installed the following geoip components:

    sudo apt-get install php5-geoip php5-dev libgeoip-dev

    Since then I get the following error in wordpress. I think it’s because wp-insert is trying to load geoip once again, although the module is already loaded in PHP.

    PHP Fatal Error: Cannot redeclare geoip_country_code_by_name() in […]/wp-insert/includes/common/geoip/ on line 438

    Could you please include_once instead of including the geoip component? The problem is with a namespace conflict under geoip_country_code_by_name.

    Some people suggest to put it within an if-statement like this:

    if (!function_exists('geoip_country_code_by_name')){
        function geoip_country_code_by_name($gi, $name) {
          $country_id = geoip_country_id_by_name($gi,$name);
          if ($country_id !== false) {
                return $gi->GEOIP_COUNTRY_CODES[$country_id];
          return false;


Viewing 1 replies (of 1 total)
  • Plugin Author namith.jawahar


    There are some issues with GEO IP in certain configurations.

    There are protection in place in the plugin to prevent this but in some cases they are not getting fired. Im trying to avoid having GEOIP in the plugin and moving the country detection to outside of the plugin in the future version to prevent this issue. This will be a high traffic situation for our server and Im trying to figure out a solution where we can still provide this service for free…

Viewing 1 replies (of 1 total)
  • The topic ‘GeoIP: Cannot redeclare geoip_country_code_by_name()’ is closed to new replies.