Sphinx 配置

wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz

tar zxvf coreseek-4.1-beta.tar.gz && cd coreseek-4.1-beta

【先安装mmseg3】

cd mmseg-3.2.14

./bootstrap   #输出的warning信息可以忽略,如果出现error则需要解决

./configure --prefix=/usr/local/mmseg3

make

sudo make install

cd ..

【安装coreseek】

cd csft-4.1

sh buildconf.sh    #输出的warning信息可以忽略,如果出现error则需要解决

./configure --prefix=/usr/local/coreseek  --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql --with-python LIBS=-liconv

##添加--with-python选项来支持Python数据源,二是添加LIBS=-liconv来避免最后的链接错误。

解决 Python.h:没有那个文件或目录 错误的方法

安装python-dev,这是Python的头文件和静态库包:

sudo apt-get install python-dev

##如果提示mysql问题,可以查看MySQL数据源安装说明   http://www.coreseek.cn/product_install/install_on_bsd_linux/#mysql

make && make install

cd

遇到的问题:

error: cannot find input file: src/Makefile.in

或者遇到其他类似error错误时...

解决方案:

依次执行下面的命令,我运行'aclocal'时又出现了错误,解决方案请看下文描述

aclocal

libtoolize --force

automake --add-missing

autoconf

autoheader

make clean

安装好'libtool'继续从'aclocal'开始执行上面提到的一串命令,执行完后再运行最开始的安装流程即可。

apt-get install libtool

出现这个 xmlpipe2 support NOT compiled in. To use xmlpipe2, install missing XML libra  错误

apt-get install libxml2-dev libexpat1-dev

Sphinx扩展安装安装

Coreseek官方教程中建议php使用直接include一个php文件进行操作,事实上php有独立的sphinx模块可以直接操作coreseek(coreseek就是sphinx!)已经进入了php的官方函数库,而且效率的提升不是一点点!但php模块依赖于libsphinxclient包。

【安装依赖libsphinxclient】

cd ./api/libsphinxclient/

#vim sphinxclient.c

找到

void sock_close ( int sock );

改为

static void sock_close ( int sock );

./configure --prefix=/usr/local/sphinxclient

configure: creating ./config.status

config.status: creating Makefile

config.status: error: cannot find input file: Makefile.in   #报错configure失败

//处理configure报错

编译过程中报了一个config.status: error: cannot find input file: src/Makefile.in这个的错误,然后运行下列指令再次编译就能通过了:

# aclocal

# libtoolize --force

# automake --add-missing

# autoconf

# autoheader

# make clean

//从新configure编译

./configure

make && make install

cd

【安装sphinx扩展】http://pecl.php.net/package/sphinx 下载最新的

wget http://pecl.php.net/get/sphinx-1.3.2.tgz && tar xvzf sphinx-1.3.2.tgz && cd sphinx-1.3.2

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config --with-sphinx=/usr/local/sphinxclient

make && make install

修改php.ini

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"

[sphinx]

extension = sphinx.so

重启php服务

sudo /etc/init.d/php-fpm restart

参考:

搭建coreseek(sphinx+mmseg3)详细安装配置+php之sphinx扩展安装+php调用示例

你可能感兴趣的:(Sphinx 配置)