一.首先安装libsphinxclient(php模块需要)

cd /usr/local/src/
tar zxvf sphinx-0.9.9.tar.gz
cd sphinx-0.9.9/api/libsphinxclient/
./buildconf.sh
./configure
make
make install

安装过程中如果报下面的错:

修改sphinxclient.c:280行,void前面加上static声明

/usr/local/src/sphinx-0.9.9/api/libsphinxclient/sphinxclient.c line 280

But when I used "sudo make" I got this error:
sphinxclient.c:1216: error: static declaration of ‘sock_close’ follows non-static
declaration
sphinxclient.c:280: note: previous declaration of ‘sock_close’ was here

So I checked the file.

On line: 280
void sock_close ( int sock );

On line: 1216
static void sock_close ( int sock )
{
#if _WIN32
closesocket ( sock );
#else
close ( sock );
#endif
}

I changed the line 280 to:
static void sock_close ( int sock );

Then I could compile it without any errors.

二.安装PHP Sphinx 扩展模块

cd /usr/local/src/
tar zxvf sphinx-1.2.0.tgz
cd sphinx-1.2.0
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config --with-sphinx=/usr/local/sphinx
make
make install

PHP配置

修改PHP.ini,
1.如果以前已配置过扩展目录则PASS

#extension_dir 目录根据 sphinx 扩展安装成功后提示的目录
extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20121212/"

2.配置文件里启用扩展
[sphinx]
extension=sphinx.so

3.重启php

最新文章

  1. discuz教程:discuz模板js与jQuery冲突的解决方案
  2. Qt使用自带的windeployqt 生成exe来发布软件
  3. 初学web开发——怎么解决无法找到路径的问题
  4. 数论 UVA 11076
  5. U3D4.X版本无法安装MONODEV编辑器
  6. HTML调用servlet(一)
  7. js为元素添加onclick事件
  8. PHP JS HTML ASP页面跳转代码 延时跳转代码
  9. 动态网页制作PHP常用的正则表达式
  10. Codeforces Round #367 (Div. 2) B. Interesting drink (模拟)
  11. C#之父 Anders Hejlsberg
  12. Javascript异步请求你能捕获到异常吗?
  13. Linux 组与用户
  14. 关于lower_bound的使用
  15. 设计模式4 外观模式 FACADE
  16. LxNx前端F2F面试问题整理
  17. [TFRecord文件格式]基本介绍
  18. SQL 数据库语言分析总结(三)
  19. 目录导航「深入浅出ASP.NET Core系列」
  20. docker创建image

热门文章

  1. electronic初体验
  2. 什么是调整后的R方
  3. linux服务器日志剖析
  4. Pycharm----设置默认脚本请求头
  5. C# 动态加载程序集
  6. 接口强制删除namespace 为Terminating的方法
  7. k8s 命令自动补全
  8. Spring Aop实例@Aspect、@Before、@AfterReturning@Around 注解方式配置(转)
  9. MySQL建立索引的原则
  10. 更改ejs模板引擎的后缀为html