CentOS6.5 install Coreseek and Sphinx PHP Extensions

Source: Internet
Author: User
Tags fpm automake
Coreseek Introduction

Coreseek is a full-text search engine based on Sphinx Open source, unlike Sphinx, Coreseek adds a thesaurus with Chinese word segmentation. Download Coreseek installation package

This article uses the coreseek3.2.14 stable version to explain, the latest version is 4.1, but only the beta version. Can try to go to the official address http://www.coreseek.cn/download installation package, but looks like the official download address has crashed, if the download is unsuccessful, you can go to the Internet to find other download channels, I was downloaded on the Sina Micro-disk, attached address http:// Vdisk.weibo.com/s/z-jij1kq4z81. Start Installation

Ensure that the LNMP/LAMP environment is installed in the system before installing Coreseek.
Install dependent software

Yum install gcc make gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel

Upload the downloaded installation package to Linux, perform the decompression command, and then enter the directory after the decompression is complete.

Tar xzvf coreseek-3.2.14.tar.gz
CD coreseek-3.2.14

will see 3 directories are csft-3.2.14, mmseg-3.2.14, Testpack, which csft is actually Sphinx installation package, mmseg for Chinese word segmentation installation package, Testpack is installed after the Coreseek test. First install Chinese participle

CD mmseg-3.2.14
./configure--prefix=/usr/local/mmseg/

If you receive the following error
Config.status:error:cannot Find Input File:src/makefile.in
Please perform

Aclocal
libtoolize--force
automake--add-missing
autoconf

Perform compilation and install Mmseg

Make && make install

Here MMSEG installation completed, you can test the Chinese participle

Echo ' We are Chinese ' >1.txt
/usr/local/mmseg/bin/mmseg-d/usr/local/mmseg/etc 1.txt

Next Install Coreseek

Cd.. /csft-3.2.14
sh buildconf.sh #生成configure可执行文件, if the current directory already exists configure file warns: There are other versions of autoconf, but there is no guarantee that it will work, and if there are any problems , it is recommended to regenerate
./configure--prefix=/usr/local/coreseek \
--without-unixodbc \
--with-mmseg=/usr/local/mmseg \
--with-mmseg-includes=/usr/local/mmseg/include/mmseg/\
--with-mmseg-libs=/usr/local/mmseg/lib/\
--with-mysql make
&& make install

The Coreseek is complete, test the Coreseek

Cd.. /testpack #进入安装包提供的测试目录
/usr/local/coreseek/bin/indexer-c etc/csft.conf--all  #创建索引
/usr/local/ Coreseek/bin/search-c etc/csft.conf ' We are Chinese '

Paste_image.png

The following error may occur when creating an index
1./usr/local/coreseek/bin/indexer:error while loading shared libraries:libmysqlclient.so.18:cannot open Shared object File:no such file or directory

#解决办法
Echo '/usr/local/mysql/lib ' >>/etc/ld.so.conf
ldconfig

2.Unigram Dictionary load Error Segmentation fault

#解决办法 (Supplemental Note: This is because the dictionary path is not correct, if the previous set of dictionary directory name is MMSEG3 will not appear this problem, pit ... )
sed ' s/mmse3/mmseg/' etc/csft.conf
install Sphinx Extension for PHP
#sphinx扩展依赖于libsphinxclient, first install libsphinxclient
CD api/libsphinxclient
./configure make
&& Make install
#下载并安装sphinx扩展
wget http://pecl.php.net/get/sphinx-1.3.2.tgz
tar zxvf 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 make
&& make install

If you report the following error when installing Libsphinxclient
Sphinxclient.c:1216:error:static declaration of ' sock_close ' follows non-static declarationsphinxclient.c:280:note: Previous declaration of ' Sock_close ' is here
Please perform

Sed-ie ' 280s/^/static/' sphinxclient.c

Next, modify the php.ini file
Add the following line to the appropriate location, such as the Extension_dir configuration line below
Extension=sphinx.so
You can see that the Sphinx Extension module has been added to PHP by executing the following command

/usr/local/php/bin/php-m #查看php扩展模块列表

But at this time still can't use Sphinx in PHP, need to restart PHP-FPM, I use Php-fpm.pid file control PHP-FPM process here
Execute reboot PHP-FPM command

KILL-USR2 '/usr/local/php/var/run/php-fpm.pid '

Print phpinfo () after reboot successful

Author: Barry Feng
Link: http://www.jianshu.com/p/825872bc6d0e
Source: Jianshu
Copyright belongs to the author. Commercial reprint please contact the author to obtain authorization, non-commercial reprint please indicate the source.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.