php sphinx 高效率搜索引擎…
来源:互联网 发布:c语言用递归求n的阶乘 编辑:程序博客网 时间:2024/06/04 18:05
原文地址:sphinx 高效率搜索引擎搭建(二)">php sphinx 高效率搜索引擎搭建(二) 作者:zqeesoom
1.下载PHP客户端安装:
http://pecl.php.net/package/sphinx
vim sphinxclient.c
找到
voidsock_close ( int sock );
改为
staticvoid sock_close ( int sock );
找到
void
改为
static
2.安装sphinx,前提你已经安装mysql且安装了mysql-devel 重源码安装mysql的
mysql-devel都已经安装,yum安装的运行
yum -y install mysql-devel
下载sphinx2.0.1 地址:
http://sphinxsearch.com/downloads/
tar -xvzf sphinx-2.0.1-beta.tar.gz
cdsphinx-2.0.1-beta
./configure--prefix=/usr/local/sphinx --with-mysql --with-iconv
cd
./configure
备注:64位增加参数--enable-id64
make && make install
cd/usr/local/sphinx/etc/
cpsphinx.conf.dist sphinx.conf
cd
cp
配置:
#
#Sphinx configuration file sample
#
#WARNING! While this sample file mentions all available options,
#it contains (very) short helper descriptions only. Please refer to
#doc/sphinx.html for details.
#
#############################################################################
##data source definition
#############################################################################
sourcesrc1
{
# data source type. mandatory, no default value
# known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
type = mysql
#####################################################################
## SQL settings (for 'mysql' and 'pgsql' types)
#####################################################################
# some straightforward parameters for SQL source types
sql_host = localhost
sql_user = root
sql_pass = ******
sql_db = ******
sql_port = 3306 # optional, default is 3306
# UNIX socket name
# optional, default is empty (reuse client library defaults)
# usually '/var/lib/mysql/mysql.sock' on Linux
# usually '/tmp/mysql.sock' on FreeBSD
#
sql_sock = /tmp/mysql.sock
# MySQL specific client connection flags
# optional, default
#
#
#
#
#
#
#############################################################################
##
#############################################################################
source
{