WordPress.org

Ready to get started?Download WordPress

Forums

Wp-Insert
[resolved] GeoIP: Cannot redeclare geoip_country_code_by_name() (2 posts)

  1. infernet
    Member
    Posted 11 months ago #

    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/geoip.inc 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;
        }
    }

    HTH

    http://wordpress.org/plugins/wp-insert/

  2. namith.jawahar
    Member
    Plugin Author

    Posted 11 months ago #

    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...

Reply

You must log in to post.

About this Plugin

About this Topic

Tags