【发布时间】:2014-09-26 14:56:26
【问题描述】:
我想配置 GeoIP 以根据共享服务器中的国家 IP 地址将域重定向到子域。我创建了一个自定义php.ini 来导入geoip.so,然后在我的index.php 中添加了以下代码:
<?php
require_once('/home/fuiba/php.ini');
$gi = geoip_open('GeoIP.dat', GEOIP_MEMORY_CACHE);
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);
$my_countries = 'fr';
if (strtolower($country) == $my_countries) {
header('Location: fr.fuiba.org');
}
$my_countriessss = 'us';
if (strtolower($country) == $my_countriessss) {
header('Location: en.fuiba.org');
}
?>
在浏览器中出现此错误:
extension=geoip.so
Fatal error: Call to undefined function geoip_open() in /home/fuiba/public_html/index.php on line 3
GeoIP 安装在服务器中。我在 info.php 上查看过:geoip version 1.0.8.
【问题讨论】: