Vlad
Vlad

Reputation: 2773

geoip_record_by_name returns nothing?

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.

Upvotes: 0

Views: 5674

Answers (2)

Bogdan_G
Bogdan_G

Reputation: 21

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.

Upvotes: 1

drkjc
drkjc

Reputation: 36

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.

Upvotes: 2

Related Questions