Want your PHP application to convert IP-addresses to countries? Then GeoIP is what you are looking for!
Configuring GeoIP is easy. Just run the following commands and it's arranged:
pear channel-update pear.php.net pecl install geoip pear install Net_GeoIP