首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gentoo geoip安装

gentoo geoip安装
EN

Stack Overflow用户
提问于 2010-09-04 14:05:18
回答 2查看 3.3K关注 0票数 3

我试图通过我的gentoo服务器上的SSH安装geoip扩展。我做了:

出现Geo

::好

pecl安装geoip

::好

geoiplookup www.bbc.co.uk

:给我GeoIP乡村版: GB,英国GeoIP城市版,Rev 1: GB,N7,Tadworth,(null),51.283298,-0.233300,0,0 GeoIP城市版,Rev 0: GB,N7,Tadworth,(null),51.283298,-0.233300

看上去很好!现在,我尝试将其添加为php扩展:我添加了

extension=/usr/local/php5/lib/php/extensions/geoip.so

转到php.ini

和重新声明apache

/etc/init.d/apache重新启动

但是我的phpinfo()不包含任何geoip库和

给出错误:调用未定义函数geoip_record_by_name()

有人能帮我在gentoo上安装geoip吗?

谢谢

EN

回答 2

Stack Overflow用户

发布于 2011-05-03 13:18:15

您是否检查了是否存在文件:/usr/local/php 5/lib/php/扩展名/Geoip.so?如果没有,请使用find命令查找它:

代码语言:javascript
复制
find /usr -name "geoip.so" -print

并在extension=之后设置合适的路径

如果无法找到它,除非您希望通过pecl安装它,否则您可能希望为此安装gentoo包:

代码语言:javascript
复制
emerge -v dev-php5/pecl-geoip
票数 1
EN

Stack Overflow用户

发布于 2012-02-23 14:16:28

如果没有谷歌,我们该怎么办?我在这里找到了一些说明:http://www.pc-freak.net/blog/how-to-install-and-setup-and-test-geoip-support-in-php-on-apache2-in-debian-lenny-linux/http://no2.php.net/manual/en/install.pecl.php

代码语言:javascript
复制
# emerge dev-php/pecl-geoip 
 * Last emerge --sync was 43d 4h 12m 46s ago.
>>> Verifying ebuild manifests
>>> Starting parallel fetch
>>> Emerging (1 of 2) dev-libs/geoip-1.4.8
>>> Installing (1 of 2) dev-libs/geoip-1.4.8
>>> Emerging (2 of 2) dev-php/pecl-geoip-1.0.7-r1
>>> Installing (2 of 2) dev-php/pecl-geoip-1.0.7-r1
>>> Recording dev-php/pecl-geoip in "world" favorites file...
# /etc/init.d/apache2  restart 
 * apache2 not running (no pid file)
 * Starting apache2 ...       [ ok ]

# cd /usr/share/GeoIP
# wget http://www.pc-freak.net/bshscr/geoip_update.sh 
--2012-02-23 15:09:01--  http://www.pc-freak.net/bshscr/geoip_update.sh
Resolving www.pc-freak.net... 83.228.93.76
Connecting to www.pc-freak.net|83.228.93.76|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 270 [application/x-sh]
Saving to: `geoip_update.sh'

100%[=============================>] 270         --.-K/s   in 0s      

2012-02-23 15:09:01 (54.4 MB/s) - `geoip_update.sh' saved [270/270]

# bash geoip_update.sh 
--2012-02-23 15:10:07--  http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
Resolving geolite.maxmind.com... 174.36.207.186
Connecting to geolite.maxmind.com|174.36.207.186|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17572430 (17M) [text/plain]
Saving to: `GeoLiteCity.dat.gz'

100%[=============================================>] 17,572,430  2.63M/s   in 9.0s    

2012-02-23 15:10:16 (1.86 MB/s) - `GeoLiteCity.dat.gz' saved [17572430/17572430]

# ln -s  GeoLiteCity.dat  GeoIPCity.dat 

# cd /var/www/raptor.lan/htdocs/ # <-- MY WEB ROOT
# mkdir -p tmp/geoip
# cd tmp/geoip/
# cat hmz.php 
<?php

echo "<pre>";
print_r(geoip_record_by_name('php.net'));

?>
# curl http://localhost/tmp/geoip/hmz.php
<pre>Array
(
    [continent_code] => NA
    [country_code] => US
    [country_code3] => USA
    [country_name] => United States
    [region] => CA
    [city] => Sunnyvale
    [postal_code] => 94089
    [latitude] => 37.424900054932
    [longitude] => -122.0074005127
    [dma_code] => 807
    [area_code] => 408
)

任务完成了?

顺便说一下。你的配置可能是错的。

代码语言:javascript
复制
# equery f dev-php/pecl-geoip  | grep ini 
/etc/php/apache2-php5.3/ext-active/geoip.ini
/etc/php/apache2-php5.3/ext/geoip.ini
/etc/php/cli-php5.3/ext-active/geoip.ini
/etc/php/cli-php5.3/ext/geoip.ini
raptor: ~
# cat /etc/php/apache2-php5.3/ext-active/geoip.ini 
extension=geoip.so
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3642608

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档