Problem with geoip module

I can’t figure out what’s wrong, I have dle 9.3, installed the module online. Writes this error

Fatal error: Cannot redeclare geoip_country_code_by_name() in /home/sergey1/test/engine/classes/geoip/geoip.inc on line 346

Here is the file itself: http://rghost.ru/13295701. Please help.


Answer 1, authority 100%

geoip_country_code_by_name() function is already defined, and it will not be possible to redefine it, because php does not support function overloading.

But if you googled it, you could find the solution yourself, try wrapping the function in

if (!function_exists('<function name>')) {
//
}

Answer 2, authority 50%

Perhaps the following advice will also help you: replace all includewith include_once(here you have to be careful, the result returned by include can probably be used, if it does, then you don’t need to replace it) and requareto requare_once, this will avoid including the same scripts multiple times and, as a result, MAYBE will not allow you to redefine the function. If this is not a repeated connection of the same script, most likely you will still have to delve into the code to fix the error.

P.S. @uvladsuggested wrapping the function declaration in an if to avoid trying to declare an existing function .


Answer 3

You seem to be including the same file twice. Review the logic of the program so that this does not happen.
If this is difficult, then two options have already been offered to you. I’ll suggest a third one – change geoip.inc like this:

if(!defined('GEO_IP_INC'))
{
    define('GEO_IP_INC', 1);
    // geoip.inc
}

The result is the same as using include/require_once;


Answer 4

It looks like you have the geoip php module enabled. Turn off the module or split the code:
if(extension_loaded(‘geoip’)) {

} else {

}