PHP Classes

File: INSTALL.txt

Recommend this page to a friend!
  Classes of Dwayne Rothe  >  IP2Country PHP  >  INSTALL.txt  >  Download  
File: INSTALL.txt
Role: Documentation
Content type: text/plain
Description: Installation instructions
Class: IP2Country PHP
Get information of the country of an IP address
Author: By
Last change: New information
Date: 11 years ago
Size: 2,365 bytes


Class file image Download
 ip2country PHP - MySQL - 1 December 2010

Installing ip2country PHP is really quite easy even for a novice php user,
just a few simple rules to follow.

You will need a server with access to 1 MySQL database and PHP of course.

First step is to install the database, the easiest way to do this is to
IMPORT the ip2countryphp.sql file from the db folder using your servers
phpmyadmin or similar. This will create the database "ip2countryphp" and
the table "ranges" and load all the data, there are 132,115 rows to load 
so this might take a few minutes.

After you have done that you will need to upload the ip2countryphp directory
and its contents to your server, generally it is a good idea to upload this 
to your htdocs/root dir, make sure you upload the flags folder in BINARY mode 
and all other files/folders in ASCII mode.

Next you must edit the ip2countryphp.sql.php class file and enter your MySQL
database connection settings.

Once that is done you can test it works by calling one of the example files, 
type the url to the example.php file in your browsers address bar and go.

You should see your ip info displayed. 

NB: When testing on a localhost setup like xampp etc... you will probably see, Reserved or, Unknown ?. This is because the localhost ip 
is which is reserved or ::1 which is an invalid ip and returns

If you are calling the ip2countryphp.sql.php class from outside the ip2countryphp directory
please make sure the BASEDIR path is correctly pointing to the ip2countryphp directory
including the end forward slash / this MUST be a relative path only !!!

e.g  say if your page is in your htdocs/root dir then you would use 
define("BASEDIR","ip2countryphp/"); or define("BASEDIR","./ip2countryphp/");

You must always keep the same ip2countryphp directory structure, the class file
and the "flags" folder MUST be together in the same directory.


 Want to be notified when updates are available?
 go to
For more information send a message to info at phpclasses dot org.