Track your visitors by GeoIP – Part 2

This article is continued from Part 1.

Warning: geoip_record_by_name() [function.geoip-record-by-name]: Required database not available at /usr/share/GeoIP/GeoIPCity.dat. in /var/www/test.php on line 3 1.

As you see in the warning above tells us that we need to install GeoIPCity.dat

1. Install cities

wget https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
sudo mkdir -v /usr/share/GeoIP
sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

2. Search php.net for geoip_record_by_name() and you’ll get documentation over geoip functions etc..