php教程

运行时配置

这些函数的行为受 php.ini 中的设置影响。

GeoIP 配置选项
名字 默认 可修改范围 更新日志
geoip.custom_directory "" PHP_INI_ALL

这是配置指令的简短说明。

geoip.custom_directory string

默认为空,但是可以设置一个不同的数据库来覆盖该扩展自带的数据库。

User Contributed Notes

sly_one at abv dot bg 18-Jun-2017 12:47
For me, It was needed also GeoIPCity.dat and adding extension to php.ini "extension=geoip.so" at the end of [PHP] section.

So ..
$details = geoip_record_by_name($ip_addr);

var_dump($details);

Now It works! :)
James 08-Sep-2015 05:13
This page is unclear on exactly which MaxMind DB you need.

I found the answer here: http://h3x.no/2010/11/10/php-geoip-required-database-not-available-at-usrsharegeoipgeoip-dat

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

MaxMind may have changed their site recently to highlight a different format; if you look on http://dev.maxmind.com/geoip/geoip2/geolite2/ it links to a mmdb format file now.

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788