Geoip

GeoIP extension PHP 7.x + AMI / Redhat / CentOs Linux

GeoIP extension PHP 7.x + AMI / Redhat / CentOs Linux

Small 2019 update – Please check out this library – github.com/maxmind/MaxMind-DB-Reader-php

It’s a straight replacement of PHP module.


GeoIP extensions is quite use-full, but it requires some server – side magic. If you are looking for something simpler, just go with  ipstack.com or something similar – GeoIP .

Otherwise:

wget http://pear.php.net/go-pear.phar
php go-pear.phar

We need geoip-devel libraries:

yum install geoip-devel

And newest (not stable) version of geoip:

sudo ./pecl install geoip-1.1.1

Don’t forget to add extension=geoip.so to your php.ini file.

How to Install GeoIP extension on CentOS

How to Install GeoIP extension on CentOS

Small 2019 update – Please check out this library – github.com/maxmind/MaxMind-DB-Reader-php . It’s a straight replacement of PHP module.

GeoIP from PECL is powerful extension used to determine geographical locations of IP addresses and domain names. This is useful if you want to set a language or redirection based on location of your visitor. Check out the PHP docs for a full list of GeoIP functions .