0

I tried this tutorial http://tech.cibul.net/install-maxminds-geoip-ip-database-on-ubuntu-for-php/ and did everything from it. Compiled the geoip module and also the php extension on my Ubuntu 11.10 installation.

I also tried this more simpler terminal command

(sudo) apt-get install php5-geoip 

And it showed successful installation but when I try

geoip_record_by_name('127.0.0.1')

and it still gives nothing, i.e. no array at all.

2 Answers 2

2

Try a different IP address - for example 111.111.111.111 as you are checking your localhost (127.0.0.1) - it may not run locally anyway.

See geoip_record_by_nameDocs:

Returns the associative array on success, or FALSE if the address cannot be found in the database.

You get back FALSE because the address was not found in the database.

1

There is important discussion on this subject at https://bugs.php.net/bug.php?id=59753

The problem with this function is that it returns a "PHP Notice" when a address can not be found.

In plain the behavior this function take on normal internal address that is not expected to return location ( record ) from its database is to return "false" that is good and expected, but additional it send "PHP Notice" that is normally used to report real coding or library problems, but not expected results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.