Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,239
    Plugin Contributions
    1

    Default Cannot redeclare geoip_load_shared_mem()

    The reason for the error message :

    [23-Apr-2013 13:42:26 Europe/London] PHP Fatal error: Cannot redeclare geoip_load_shared_mem() (previously declared in mydomain.com/includes/geoip.inc:241) in mydomain.com/includes/geoip.inc on line 257

    is because I have included the following code on my tpl_main_page.php ...

    Code:
    <!--BOF cookie control script-->
     <?php
    include(DIR_WS_INCLUDES . "geoip.inc");
    $gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat", GEOIP_STANDARD);
    $visitor_ip_address = $_SERVER["REMOTE_ADDR"];
    $visitor_country_code = geoip_country_code_by_addr ($gi,$visitor_ip_address);
    if ($visitor_country_code =='BE'|| $visitor_country_code =='BG'|| $visitor_country_code =='CZ'|| $visitor_country_code =='DK'|| $visitor_country_code =='DE'|| $visitor_country_code =='EE'|| $visitor_country_code =='IE'|| $visitor_country_code =='GR'|| $visitor_country_code =='ES'|| $visitor_country_code =='FR'|| $visitor_country_code =='IT'|| $visitor_country_code =='CY'|| $visitor_country_code =='LV'|| $visitor_country_code =='LT'|| $visitor_country_code =='LU'|| $visitor_country_code =='HU'|| $visitor_country_code =='MT'|| $visitor_country_code =='NL'|| $visitor_country_code =='AT'|| $visitor_country_code =='PL'|| $visitor_country_code =='PT'|| $visitor_country_code =='RO'|| $visitor_country_code =='SI'|| $visitor_country_code =='SK'|| $visitor_country_code =='FI'|| $visitor_country_code =='SE'|| $visitor_country_code =='GB')
    require($template->get_template_dir('tpl_cookie_control.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_cookie_control.php');
    ?>
    <!--EOF cookie control script
    ... to effect the display of a cookie alert banner only for EU visitors. This is causing conflict with Supertracker mod which uses geoip.inc to get the country code, at the same time.

    Any suggestions on how to improve my code to stop these error messages (which occur every time a non-robot visitor visits my site - I exclude bots from s/tracker) would I'm sure, be extremely helpful.

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,239
    Plugin Contributions
    1

    Default Re: Cannot redeclare geoip_load_shared_mem()

    ok, changing

    include(DIR_WS_INCLUDES . "geoip.inc");

    to

    include_once(DIR_WS_INCLUDES . "geoip.inc");

    seems to do the trick. I'll have to keep an eye out for any ill effects

  3. #3
    Join Date
    Jan 2012
    Posts
    488
    Plugin Contributions
    0

    Default Re: Cannot redeclare geoip_load_shared_mem()

    Thanks for this.

    It fixed it for me as well.

 

 

Similar Threads

  1. Cannot redeclare _sess_open
    By trouble730 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 0
    Last Post: 24 Dec 2010, 07:10 PM
  2. Cannot redeclare zen_js_zone_list()
    By doonyuen in forum General Questions
    Replies: 1
    Last Post: 3 Aug 2009, 04:40 PM
  3. Cannot redeclare zen_address_format()
    By haontech in forum Installing on a Windows Server
    Replies: 4
    Last Post: 10 Mar 2007, 06:27 AM
  4. Cannot redeclare class
    By (Deus) in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 2 Feb 2007, 06:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR