Title: Fatal PHP error on activation due to duplicate function names
Last modified: August 21, 2016

---

# Fatal PHP error on activation due to duplicate function names

 *  Resolved [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/)
 * Hi,
 * This looks a useful plugin for programmers to build upon. Thank you! I was beginning
   to use it to build a country selector within another plugin.
 * However, on the site I want to deploy upon, another plugin already has the same
   GeoIP library included. This causes a fatal error, as your library does not apply
   checks for whether the library is already loaded (the other plugin does – but
   unfortunately the other plugin can get loaded first).
 * i.e. To make your plugin play nice with other plugins, you need to add various
   wrappers like:
 * > if(!class_exists(‘geoiprecord’)) {
   >  class geoiprecord { // (Previous contents
   > of geoiprecord class) } }
 * Alternatively, if you are happy to be PHP 5.3 only, then use name-spacing.
 * Even better: update from the legacy PHP API to the current one: [https://github.com/maxmind/GeoIP2-php](https://github.com/maxmind/GeoIP2-php)
 * Best wishes,
    David
 * [https://wordpress.org/plugins/geoip-detect/](https://wordpress.org/plugins/geoip-detect/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638581)
 * Hi,
 * I’ve created for you a patched version of this plugin with 3 improvements… get
   it here: [http://david.dw-perspective.org.uk/tmp/geoip-detect.1.5.1.zip](http://david.dw-perspective.org.uk/tmp/geoip-detect.1.5.1.zip)
 * You are welcome to release this patched version as your next version.
 * The 3 improvements are as follows:
 * * FIX: Does not cause fatal errors if another plugin has already loaded the GeoIP
   library (checks function + class existence first)
 * * FIX: Prevent PHP notice when looking up IPs with no region entry in GeoIP database
 * * FIX: Remove duplicate copy of GeoIP library (your plugin had 2 copies in, and
   only one was used) and other unused testing scripts from the GeoIP library
 * This is still using the old PHP API. I am in a hurry so just wanted to get something
   working quickly!
 * Best wishes,
    David
 *  Plugin Author [Benjamin Pick](https://wordpress.org/support/users/benjaminpick/)
 * (@benjaminpick)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638824)
 * Many thanks for taking the pain and even proposing a patch! I will have a look
   at it and adapt it in a way that I don’t need to modify the Maxmind files.
 * Yes I agree the APIv2 would be great but AFAIK it is still in beta. Definitely
   something I consider for the long-term. However we will have to see how to keep
   backwards compatibility, I don’t want to include both libraries yet existing 
   code should continue working.
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638825)
 * Hi Benjamin,
 * Thanks for getting back.
 * It looked to me like APIv2 is no longer in beta – the github page says that v1
   is “legacy”, and I can’t see any indications for v2 of not being current.
 * Based on that, I wouldn’t worry about modifying the MaxMind libraries, as they’re
   not likely to be further developed. There shouldn’t be future changes to include.
   Actually the versions I put into yours were a fork maintained by Diego Zanella
   for one of his plugins ([http://dev.pathtoenlightenment.net/shop/currency-switcher-woocommerce/](http://dev.pathtoenlightenment.net/shop/currency-switcher-woocommerce/)),
   so you shouldn’t have any maintenance work. (And if you did, it should be minimal,
   presuming that you’re planning to switch from the legacy library anyway).
 * David
 *  Plugin Author [Benjamin Pick](https://wordpress.org/support/users/benjaminpick/)
 * (@benjaminpick)
 * [12 years ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638912)
 * class_exists()-Wrappers will be include in the about-to-be-released Version 1.6
 *  Thread Starter [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [12 years ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638913)
 * Hi,
 * Thanks – did you include any of the other 2 fixes (mentioned in my second post
   in this thread) in that release?
 * David
 *  Plugin Author [Benjamin Pick](https://wordpress.org/support/users/benjaminpick/)
 * (@benjaminpick)
 * [12 years ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638914)
 * Yes I did include other minor fixes from your version while not modifying the
   vendor-Library.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Fatal PHP error on activation due to duplicate function names’ is closed
to new replies.

 * ![](https://ps.w.org/geoip-detect/assets/icon-256x256.jpg?rev=978998)
 * [Geolocation IP Detection](https://wordpress.org/plugins/geoip-detect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geoip-detect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geoip-detect/)
 * [Active Topics](https://wordpress.org/support/plugin/geoip-detect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geoip-detect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geoip-detect/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Benjamin Pick](https://wordpress.org/support/users/benjaminpick/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/fatal-php-error-on-activation-due-to-duplicate-function-names/#post-4638914)
 * Status: resolved