카테고리 없음

How to Install GeoIP extension on CentOS

[czar] 2016. 2. 18. 10:25
http://www.spidersoft.com.au/2012/how-to-install-geoip-extension-on-centos/


We start by installing the GeoIP library on your system.
yum install GeoIP-devel
yum install php-pear
yum install php-pecl-geoip




php 사용가능하도록

Last option we need to remember is just to create entry in out php.ini file

extension=geoip.so



We can also update out database, to the most recent DB file:

cd /usr/share/GeoIP
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
mv GeoLiteCity.dat GeoIPCity.dat



php 에서 확인


$record = geoip_record_by_name($_SERVER["REMOTE_ADDR"]);
    if ($record) {
        print_r($record);
    }