安裝GEOIPphp
[root@i -it ~]# yum install GeoIP GeoIP-deve數據庫
##下載GeoIP的數據庫,有精確到國家和地區包括IPv6 自行選擇...###spa
[root@i -it ~]# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz.net
[root@i -it ~]# tar zxf GeoLiteCity.dat.gzseo
[root@i -it ~]# mv GeoIPCity.dat /data/seo/misc/GeoIPCity.datip
##下載GeoIP PECL擴展##get
[root@i -it ~]# wget http://pecl.php.net/get/geoip-1.0.8.tgit
##安裝##io
[root@i-it ~]# tar zxf geoip-1.0.8.tgz class
[root@i-it ~]# cd geoip-1.0.8
[root@i-it geoip-1.0.8]# /software/php/bin/phpize
[root@i-it geoip-1.0.8]# ./configure --with-php-config=/software/php/bin/php-config --with-geoip
[root@i-it geoip-1.0.8]# make && make install
###修改PHP配置文件###
[root@i-it seo]# vi /software/php/etc/php.ini
extension = "geoip.so"
###指定geoip數據的路徑##
geoip.custom_directory=/data/seo/misc/