centos6.4安装sphinx(php)

1.安装前请先确定安装了常用的组件

       yum install -y python python-devel

2.安装sphinx

tar zxvf sphinx-2.2.10-release.tar.gz
cd sphinx-2.2.10-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。

3.libsphinxclient 安装(PHP模块需要)


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

4.安装PHP的Sphinx模块

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


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

5.vi /etc/php.ini

添加 :extension = sphinx.so

重启:service php-fpm restart(nginx服务器)




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值