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.