Next Previous Contents

5. Build the database

The work of creating the database files is all handled by the countryiptsetup.php program. It will do all the work for you while you sit back and wait for it to finish.

If you think you're ready, go ahead and click on "Generate Database".

Go to the refrigerator and get a Coke or something. Don't be alarmed, on a slow server, this can take several minutes. It might appear as though your web browser is stalling, but it's just waiting for the page to come back after all the new files are created. Be patient.

If you'd like you can monitor the progress by periodically looking at the 'country' directory. There are 256 files being created, all beginning with a number and ending with .php. Also, one additional file called countries.php will be created at the end.

Don't interrupt the process - don't hit the stop button in your browser. Give it time to complete the task of building the files.

A modern-day fast server will probably get the job done quite rapidly, but some of us are still using some older equipment.

NOTE: If something goes wrong or the process gets interrupted, don't panic. Just do it again. Any existing files that were created will be deleted and replaced by new ones. This would be no different than the actual process of updating each month when an updated .csv database file is installed.

When your browser comes back to life, the setup job should be all finished. However, if something went wrong, you'll likely see an error message of some sort, most likely from php complaining that it can't create the files. Check the permissions applied to the directory you are using. That should be the only problem you are likely to encounter.

I doubt the problem would be a lack of disk space. Most users nowadays have gigs and gigs of storage space. In any case, the php files only take up about 27K of space, the .csv file eats up about 3MB-6MB and the newly created database files use about another 3MB-5MB. So, less than 7MB-12MB of free space will do the job. If you don't have that much available, then just turn your computer off and forget it. You probably can't do much with it anyway. Get a Commodore 64, it doesn't need much in the way of resources. (You can tell what my bread and butter is).

5.1 Updating the database

Now that the database files are built, we are all done with both the .csv database file and the countryiptsetup.php file. However, the .csv database file gets updated periodically, maybe every couple of months or so. Whenever that happens, just go download a new version of it, copy it in place of the existing .csv database file and then rerun the countryiptsetup.php program. It will upgrade all the existing database files for you. It's as simple as clicking on "Generate Database".

Whenever you recreate new updated database files, the countries.php file is also recreated. This file stores your country selections. Your existing settings will be preserved and restored when the new countries.php file is created.

NOTE: If you decide to switch from one database to the other (IP-to-Country vs. MaxMind), be sure to either delete the countries.php file or rename it to something else if you'd like to preserve it. The reason for this is due to the slightly different names each database gives to some of the countries. When you switch, your default settings are not preserved. This need not be done if you stick with the same database provider.

Next Previous Contents