MaxmindDB (GEO-IP) as PHP Extension

From HostmasterWiki
Jump to: navigation, search

Prepare[edit]

$ sudo apt-get install gcc make
 
$ wget \
https://github.com/maxmind/libmaxminddb/releases/download/1.0.4/libmaxminddb-1.0.4.tar.gz \
https://github.com/maxmind/MaxMind-DB-Reader-php/archive/v1.0.2.tar.gz
$ tar xvfz libmaxminddb-1.0.4.tar.gz && tar xvfz v1.0.2.tar.gz


Compile[edit]

libmaxminddb[edit]

$ cd libmaxminddb-1.0.4
$ ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var
$ make
$ sudo make install

php-maxminddb[edit]

$ cd MaxMind-DB-Reader-php-v1.0.2/ext
$ phpize
$ ./configure
$ make
$ sudo make install


Install[edit]

add "extension= maxminddb.so" to your php.ini