安装 php5-geoip 失败

installing php5-geoip fails

当我尝试在我的 debian 上安装 php5-geoip 时,出现错误:

root@pandora:~# LANG=C apt-get install php5-geoip
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5-geoip : Depends: phpapi-20100525
E: Unable to correct problems, you have held broken packages.
root@pandora:~#

当我尝试安装依赖项时,输出如下:

root@pandora:~# LANG=C apt-get install phpapi-20100525
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package phpapi-20100525 is a virtual package provided by:
  php5-fpm 5.4.45-0+deb7u2 [Not candidate version]
  php5-cli 5.4.45-0+deb7u2 [Not candidate version]
  php5-cgi 5.4.45-0+deb7u2 [Not candidate version]
  libphp5-embed 5.4.45-0+deb7u2 [Not candidate version]
  libapache2-mod-php5filter 5.4.45-0+deb7u2 [Not candidate version]
  libapache2-mod-php5 5.4.45-0+deb7u2 [Not candidate version]

E: Package 'phpapi-20100525' has no installation candidate
root@pandora:~#

apt-get update 和 apt-get upgrade 都可以使用,无需更新或安装。 我可以安装任何其他包。

如果有人愿意帮助我,谢谢:-)

根据您收到的错误,您没有可用的包与您当前的 PHP 包相匹配。你有两个选择。首先,您可以使用 the new PHP version(不需要编译代码。)如果您已经为您的项目安装了 composer,您可以轻松地做到这一点:

php composer.phar require geoip2/geoip2:~2.0

或者,第二个选择,从 PECL 安装原始包。假设您已经安装了合适的 PEAR 包,并且有可用的开发工具(例如 makegcc),您可以尝试以下步骤:

apt-get install libgeoip-dev
pecl install geoip

有关详细信息,请参阅 here or here