Questioner
Questioner

Reputation: 7463

Why are only some of these geoip values being returned?

I have a web server running Apache2 on Ubuntu 12.04. I have installed geoip-database, libapache2-mod-geoip1.2.5-2, libgeoip1 1.4.8+dfsg-2, and php5-geoip.

I put this test PHP code on my server:

<?php
echo "country: " . apache_note("GEOIP_COUNTRY_NAME") . '<br>';
echo "code: " . apache_note("GEOIP_COUNTRY_CODE") . '<br>';
echo "city: " . apache_note("GEOIP_CITY") . '<br>';
echo "region: " . apache_note("GEOIP_REGION") . '<br>';
echo "latitude: " . apache_note("GEOIP_LATITUDE") . '<br>';
echo "longitude: " . apache_note("GEOIP_LONGITUDE") . '<br>';
echo "timezone: " . geoip_time_zone_by_country_and_region($this->countryCode, $this->region);

When I access it in my browser, I get this output:

country: Japan
code: JP
city:
region:
latitude:
longitude: 
timezone:

I'm confused by the fact that only two of the values are coming back. If the GeoIP module were not installed correctly, would it not fail completely without any values at all?

Are there some libraries or something that I am missing?

How do I get my code to return all the values, like latitude and longitude?

Upvotes: 0

Views: 241

Answers (1)

user149341
user149341

Reputation:

You're probably using the free GeoLite IP database. This database only contains country information.

The databases containing more detailed information, such as latitude and longitude, are available from Maxmind on a paid basis.

Upvotes: 1

Related Questions