Home | MySQL Russian Manual | MySQL Manual | Apache HTTP Server Rus Documentation | Apache HTTP Server Documentation | downloads | faq

search for in the  Language: Russian

GeoIP Functions

Table of Contents

User Contributed Notes
GeoIP Functions
nandox7 at myrealbox dot com
27-Dec-2008 02:49
The GeoLiteCity free db works and can resolve city names and other informations.

Make sure the instructions are followed regarding it's installation.


At step 2 the decompress file must be moved and renamed.
The files needs to be called GeoIPCity.dat if not the mod_geoip will not find it.
thomas {AT} thomasfischer {D0T} BIZ
08-Apr-2008 12:04
you can use this function to determine the continent of a country:

function getContinentFromCountry($country)
 $data = array ("AF"=> "AS","AX"=>"EU","AL"=>"EU", "DZ"=>"AF","AS"=>"OC", "AD"=>"EU","AO"=> "AF" ........);
 return $data[$country];

unfortunately this comment's size is restricted, so you will have the rest by yourself

for example:
getContinentFromCountry("DE") will result in "EU"

this data is based on
kapouer at melix dot org
01-Mar-2008 03:26
For Debian etch users : libgeoip is in version 1.4 so get the source from lenny (apt-get build-dep libgeoip;apt-get source libgeoip), compile it on etch (dpkg-buildpackage -rfakeroot in source folder) and install resulting libgeoip1 and libgeo-dev packages (dpkg -i)... Together with php5-dev this package is easy to install (phpize5;./configure --enable-geoip;make;make install)... Then check your install in php with :
echo geoip_database_info(GEOIP_COUNTRY_EDITION);

please note free .dat is in /usr/share/GeoIP/GeoIP.dat
Use geoip-bin package to schedule automatic updates (configure /etc/geoip.default.conf and copy to /etc/geoip.conf, then add a crontab to make the updates...)
hope this helps
php dot comment dot addition at gmail dot com
11-Jun-2007 03:57
Just to clarify the other comments, the maxmind post seems to be out of date / incorrect. 

This module fails to work (ie: resolve cities) with the GeoLite City database from here:

The error occurs when calling the function geoip_record_by_name(), which states incorrectly that the required database is not available.  I have tested it with the very latest database, for which geoip_database_info() returns  the version:
GEO-533LITE 20070601 Build 1 Copyright (c) 2007 MaxMind LLC All Rights Reserved

It does, however, resolve countries OK via the GeoLite Country database, which you can grab here: http://www.maxmind.com/app/geoip_country
I tested with the version:

GEO-106FREE 20070601 Build 1 Copyright (c) 2007 MaxMind LLC All Rights Reserved
tjmather at maxmind dot com
27-Feb-2007 04:09
The geoip_country_*_by_name functions only work with GeoIP Country.  The geoip_record_by_name function works with GeoIP City.  geoip_region_by_name works with GeoIP Region.  So the API should work with all of the GeoIP databases, as long as you call the correct function.
27-Jan-2007 01:23
I couldn't get it to work with the DMA code database (product ID 137).  It seems to only work with the country database.  The documentation should contain a warning that this code (as of 0.2.0) is incomplete and that Net_GeoIP should be used for non-country databases.
judas dot iscariote at gmail dot com
17-Nov-2006 03:59
If you want to use this extension in SUSE/openSUSE, it is available here:

13-Sep-2006 12:45
Both, Ubuntu and Debian itself make usage of version 1.3.x of the c libraries, so installation can't be done with the debian packages, because configure stops with:
== configure: error: You need version 1.4.0 or higher of the C API ==

so you must download it from maxmind.
08-Sep-2006 08:34
If you are a Debian or Ubuntu user, instead of building it from source, you can:
aptitude install libgeoip-dev libgeoip1

credits | contact