nginx 和 PHP GeoIP 模块的内部错误 500

Internal Error 500 with nginx and PHP GeoIP Module

我正在尝试在 PHP 脚本中查找与外部 IP(不是访问者)关联的国家/地区。我已经安装了模块。当我 运行 nginx -V, --with-geoip-module 出现在列表中时,我在 [=23= 中有 GeoIP.dat 文件]/usr/share/GeoIP/ 在我的服务器上。我的 nginx.conf:

中也有 GeoIP 文件的路径
geoip_country  /usr/share/GeoIP/GeoIP.dat; # the country IP database

这是我用来测试的代码:

<?php
    echo geoip_country_code_by_name('69.84.125.113');
?>

返回以下错误:

PHP message: PHP Fatal error: Call to undefined function geoip_open() in /usr/share/nginx/html/geoip.php on line 7" while reading response header from upstream, client: 69.84.125.113, server: localhost, request: "GET /geoip.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mydomain.com"

请帮忙,我整天都在为这个问题苦苦挣扎!!

我认为你需要先包含它。

include ("include/geoip.inc");