SunshinePHP 2016


Indice dei contenuti

add a note add a note

User Contributed Notes 8 notes

bob at qww dot cz
6 years ago
To install geoip on debian lenny:

gunzip GeoLiteCity.dat.gz
sudo mkdir -v /usr/share/GeoIP
sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

sudo apt-get install php5-geoip

and then try it in PHP:

    [country_code] => US
    [country_code3] => USA
    [country_name] => United States
    [region] => CA
    [city] => Sunnyvale
    [postal_code] => 94089
    [latitude] => 37.4249000549
    [longitude] => -122.007400513
    [dma_code] => 807
    [area_code] => 408
munitoris at inetspec dot com
6 years ago
At the time of this writing, the PECL binaries at are NOT AVAILABLE.

Specifically, the php_geoip.dll extension is not available in a pre-compiled form for Windoze PHP developers.

There are only two alternative solutions to self-compiling for Windoze (AFAIK):

1) Use the "Pure" PHP version of the GeoIP API from MaxMind available here (  This solution is not really acceptable for production machines because of its slower speed.  However, it does work for development.

2) Use the older version of this pre-compiled extension (  It worked on my development system using Windoze XP sp2, Apache 2.2.3 and PHP 5.2.10.  There are also older versions for PHP 5.1.2 and PHP 5.1.4 in the same directory.
matt at kynx dot org
6 years ago
Installation on OSX (Leopard) running MAMP

First you need MacPorts installed and operational:

Use that to install libgeoip. From a terminal window, do:

    $ sudo port install libgeoip

This installs the library in /opt/local. Unfortunately the current version of the PECL extension doesn't know to look there, so you'll need to download and compile manually from

Assuming it's in your download directory, extract it:

    $ cd ~/Downloads
    $ tar -xzf geoip-1.0.3.tgz
    $ cd geoip-1.0.3

Now edit the config.m4 file and change the SEARCH_PATH variable, as described in the following bug report:

Now you should be able to compile and install the extension as usual. Make sure you use the phpize from the MAMP package, not the one that ships with OSX:

    $ /App*/MAMP/bin/php5/bin/phpize
    $ ./configure
    $ make
    $ sudo make install

If phpize complains that it cannot find files under /Applications/MAMP/bin/php5/include, make sure you have the development version of MAMP installed (link towards the bottom of the MAMP download page).

You're nearly there! The extension will have installed in /usr/lib/php. You need to copy it into your MAMP extension directory:

    $ cd /App*/MAMP/bin/php5/lib/php/ext*/no-debug*/
    $ mv /usr/lib/php/ext*/no-debug*/ .

Now edit the php.ini file in /Applications/MAMP/conf/php5/ and add the following line:

Restart your web server and check phpinfo() - the geoip extension should now be listed.

Good luck!
ewwink at yahoo dot com
2 years ago
compiled .dll or php_geoip.dll is availbale at:

tested and worked with PHP Version 5.3.9 in windows 7 Home Premium
7 months ago
Nice to see that no one (not even PHP) provides windows instructions anymore...
ben at SPAMLESS dot ism dot net dot nz
4 years ago
SUSE (as root):

# zypper install php5-devel
# SuSEconfig
# mkdir -p /usr/share/GeoIP
# wget
(whatever the latest version is from )
# tar -xzf geoip-1.0.7.tgz
# cd geoip-1.0.7/
# phpize
# ./configure
# make
# make install
# cp /etc/php5/conf.d/gd.ini /etc/php5/conf.d/geoip.ini
# vi /etc/php5/conf.d/geoip.ini
Change to
# vi /etc/php5/apache2/php.ini
Find the [gd] section and add a new section afterwards:
geoip.custom_directory = /usr/share/GeoIP/
# /etc/init.d/apache2 restart

Check phpinfo() that geoip is loaded and the default location for the DB's is set.

If you want the free DBs that are update roughly monthly, follow the "Lite" links from and download the tar.gz to /usr/share/GeoIP/ and extract.
code at edoceo dot com
6 years ago
Installation on Gentoo (2008.0) as follows:

emerge dev-libs/geoip
pecl install geoip

Then fetch the databases to /usr/share/GeoIP (wrapped!)
cd /usr/share/GeoIP
wget \
wget \
sballeste at gmail dot com
4 years ago
If the data files under /usr/share/GeoIP/ are not readable by apache, apache's process will crash with a segfault on calls to geoip functions.
To Top