Sphinx有两种方法被php使用:
1, //直接使用sphinx的API类 :
/usr/local/centosLamp/coreseek-3.2.14/csft-3.2.14/api/sphinxapi.php
//在PHP中直接将sphinxapi.php文件包含到项目中。
2, sphinx在php打模块 :
//启动sphinx进程:
/usr/local/coreseek/bin/seachd
//查看启动进程:
netstat –tlnp
下载sphinx php模块:
Wget http://pecl.php.net/get/sphinx-1.1.0.tgz
tar xvf sphinx-1.1.0.tgz
cd sphinx-1.1.0/
/usr/local/php/bin/phpize ##为php打模块
// 在这一步先不能配置。还需要准备一些环境 我进到 coreseek源代码包中
cd /usr/local/centosLamp/coreseek-3.2.14/csft-3.2.14/api/libsphinxclient/
./configure && make && make install
//然后回到sphinx-1.1.0/下
cd /usr/local/centosLamp/sphinx-1.1.0/
./configure –-with-phpconfig=/usr/local/php/bin/php-config –enable-sphinx
make
make install //安装后你会看到下面的代码
//修改php配置文件
vi /usr/local/php/etc/php.ini
//添加如下一行代码:
//重启Apache
/usr/local/apache2/bin/apachectl restart
//访问 192.168.1.124/phpinfo.php 看到如下结果: