Centos下安装php扩展sphinx
官方地址:http://pecl.php.net/package/sphinx
wget http://pecl.php.net/get/sphinx-1.3.3.tgz tar -zxvf sphinx-1.3.3.tgz
安装php扩展必须有php-devel,没有php-devel就缺少phpize,就不会产生源代码文件,yum安装测试一下
yum install php-devel cd /usr/local/src/coreseek-4.1-beta/testpack/api/libsphinxclient/ ./configure
checking for strings.h... (cached) yes checking for unistd.h... (cached) yes checking for stdint.h... (cached) yes configure: creating ./config.status config.status: creating Makefile config.status: creating sphinxclient_config.h config.status: executing depfiles commands make && make install more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- test -z "/usr/local/include" || mkdir -p -- "/usr/local/include" /usr/bin/install -c -m 644 'sphinxclient.h' '/usr/local/include/sphinxclient.h' make[1]: Leaving directory `/usr/local/src/coreseek-4.1-beta/testpack/api/libsphinxclient'
cd /usr/local/src/sphinx-1.3.3 phpize
1 2 3 4 | Configuring for : PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 |
./configure --with-php-config=/usr/bin/php-config --with-sphinx
1 2 3 4 | checking whether to build static libraries... no configure: creating ./config.status config.status: creating config.h config.status: executing libtool commands |
make && make install
1 2 3 | Build complete. Don 't forget to run ' make test'. Installing shared extensions: /usr/lib64/php/modules/ |
cd /etc/php.d/ //还需要修改配置文件 vim sphinx.ini //下面两行写入该文件 ; Enable gd extension module extension=sphinx.so
<?php // echo phpinfo(); header("Content-type:text/html;charset=utf-8"); echo '<pre>'; $sphinx_obj = new SphinxClient(); $sphinx_obj->setServer('127.0.0.1',9312); $sphinx_obj->setMatchMode(SPH_MATCH_ANY); $res = $sphinx_obj->query('php','*'); var_dump($sphinx_obj); exit();
百度、必应、google、搜狗、360都搜过了,遇到同样的求助问题,但一直没有解决方案~~不知道哪里错了~前辈们看到请留下您的脚步~谢谢哈~
分类:
Sphinx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!