百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> CentOS6.4 X64 安装sphinx及sphinx for php扩展
分享文章到:

CentOS6.4 X64 安装sphinx及sphinx for php扩展

发布时间:01/15 来源: 浏览: 关键词:
最近工作需要需要在CentOS6.4系统是安装sphinx并且使用php扩展了,因为系统使用的是x64位系统所以方法 与32会有一点区别哦,下面我们一起来看看具体的安装过程与碰到的一个小问题解决方法


安装前请先确定安装了常用的组件,然后在官方网站下载最新的sphinx,


yum install -y python python-devel
http://sphinxsearch.com/downloads/release/

请使用稳定版,线上机器就别玩beta版啦!

安装sphinx

tar zxvf sphinx-2.1.4-release.tar.gz
cd sphinx-2.1.4-release
./configure --prefix=/usr/local/sphinx –-with-mysql
make && make install

在make时如果出现undefined reference to libiconv的错

错误描述

/usr/local/sphinx/src/sphinx.cpp:20060:undefined reference to `libiconv_open'
/usr/local/sphinx/src/sphinx.cpp:20078: undefined reference to `libiconv'
/usr/local/sphinx/src/sphinx.cpp:20084: undefined reference to `libiconv_close'
collect2: ld returned 1exit status
make[2]:***[indexer]Error1 www.111cn.net
make[2]:Leaving directory `/home/sphinx/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sphinx/src'
make: *** [all-recursive] Error 1

解决办法:


打开configure文件,找到“#define USE_LIBICONV 1”,将注释去掉,并将1改成0。


libsphinxclient 安装(PHP模块需要)


cd api/libsphinxclient
./configure –prefix=/usr/local/sphinx
make &&  make install

安装PHP的Sphinx模块  www.111cn.net


下载地址:http://pecl.php.net/package/sphinx


wget http://pecl.php.net/get/sphinx-1.3.0.tgz
tar zxf sphinx-1.3.0.tgz
cd sphinx-1.3.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-sphinx=/usr/local/sphinx/
make && make install

安装好后,在安装目录下etc目录下,有份测试数据和配置的样本


cd /usr/local/sphinx/etc
cp sphinx.conf.dist sphinx.conf将sphinx.conf里面的数据库地址,账号密码改下就好了,再将lvtao.sql

导进数据库lvtao

测试执行


/usr/local/sphinx/bin/search lvtao就可以看到一些查询的相关信息了

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有5人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板