It should be noted that this extension has now been superseded by the GeoIP2 API that MaxMind now produces. There is a pure-PHP set of classes and a C library and extension you can optionally install. The code can be found in various projects on MaxMind's GitHub page: https://github.com/maxmind/
If you have php5-geoip installed as I did, remove it with sudo apt-get remove php5-geoip; purge as necessary.
With the above done you can now test incoming IP address for v4 or v6 and get appropriate results.
Example:
<?php include_once('geoip.inc');
//set an IPv6 address for testing $ip='2601:8:be00:cf20:ca60:ff:fe09:35b5';
/* test if $ip is v4 or v6 and assign appropriate .dat file in $gi run appropriate function geoip_country_code_by_addr() vs geoip_country_code_by_addr_v6() */ if((strpos($ip, ":") === false)) { //ipv4 $gi = geoip_open("/usr/share/GeoIP/GeoIP1.dat",GEOIP_STANDARD); $country = geoip_country_code_by_addr($gi, $ip); } else { //ipv6 $gi = geoip_open("/usr/share/GeoIP/GeoIPv6.dat",GEOIP_STANDARD); $country = geoip_country_code_by_addr_v6($gi, $ip); } echo $ip . "<br>" . $country; This is specifically for Country, but can easily be replicated for City data.