============================================================
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
127.0.0.0, Reserved or 0.0.0.0, Unknown ?. This is because the localhost ip
is 127.0.0.0 which is reserved or ::1 which is an invalid ip and returns 0.0.0.0
=================
TROUBLESHOOTING
=================
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/");
*** IMPORTANT ***
You must always keep the same ip2countryphp directory structure, the class file
and the "flags" folder MUST be together in the same directory.
HAVE FUN!
================================================
Want to be notified when updates are available?
go to www.ip2countryphp.freei.me/subscribe.html
================================================ |