Lately, I've had the need to install a geolocation database on a web server to localize (as closely as possible) a visitor based on its IP address.
For this, I've been using the MaxMind geolocation database. Although Maxmind is a commercial service, they provide a free database mapping IPs to countries.
Maxmind provides a PHP geoip extension enabling a very quick access to the GeoIp database.
In this blog article, I'll describe all the required steps to install the geoip extension on a PHP server, on a CentOS distribution.