Setting up IP-to-Country database
Webhosting.info updates a csv file that matches IPs to countries and offers it to the public free of charge. The latest csv file has over 96k records.
Here is how to load the csv into the database on your webhost for those who do not have unix access:
- You have PHP 4.3 or later
- You have FTP access into your account.
- You know the database login information.
- You’ve created the table in the database to hold the data.
- Download the csv file from this page.
- Unzip the file and open the resulting csv file in a text editor.
- Find and replace ‘ with \’ and save.
- Download BigDump (created by Alexey Ozerov).
- Unzip the file and open the resulting php file in a text editor.
- Fill in the database info, the filename (ip-to-country.cvs) and the csv_insert_table (iptocountry).
- Upload the bigdump file and the csv file to a temporary directory in your account that is web accessible.
- Navigate to the bigdump file in your browser and click the start link.
- Watch the progress bar.