Cannot redeclare geoip_country_code_by_name

Today I had this error on my Ubuntu Linux box

Fatal error: Cannot redeclare geoip_country_code_by_name()

The reason was that I have geoip extension enabled in my PHP configuration and also I used the geoip.inc file from maxmind.com.

The solution is very simple. Actually, there are two solutions:

First is to disable the geoip extension from your configuration. In /etc/php5/apache2/conf.d/geoip.ini comment the first line:

[sourcecode language=”bash”]
;extension=geoip.so
[/sourcecode]

The second solution: in your geoip.inc file, look for this code

[sourcecode language=”php”]
function geoip_country_code_by_name($gi, $name) {

}

function geoip_country_name_by_name($gi, $name) {

}
[/sourcecode]

and replace with

[sourcecode language=”php”]
if (!function_exists(‘geoip_country_code_by_name’)) {
function geoip_country_code_by_name($gi, $name) {

}
}

if (!function_exists(‘geoip_country_name_by_name’)) {
function geoip_country_name_by_name($gi, $name) {

}
}
[/sourcecode]

 

4 comments


Notice: Trying to get property 'comment_ID' of non-object in /home/razvantudorica/razvantudorica.net/public_html/wp-includes/comment-template.php on line 677

Notice: Trying to get property 'user_id' of non-object in /home/razvantudorica/razvantudorica.net/public_html/wp-includes/comment-template.php on line 28

Notice: Trying to get property 'comment_ID' of non-object in /home/razvantudorica/razvantudorica.net/public_html/wp-includes/comment-template.php on line 48
Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *