[php7安装sphinx遇到的坑]

php7安装sphinx遇到的坑

首先按照网上这个方法安装前半部分没有任何问题:

地址:https://www.cnblogs.com/xi-jie/articles/10476860.html

[root@centos7-2 ~]# cd /usr/local/src

[root@centos7-2 src]# wget http://sphinxsearch.com/files/sphinx-2.2.10-release.tar.gz

[root@centos7-2 src]# tar -zxvf sphinx-2.2.10-release.tar.gz

[root@centos7-2 src]# cd sphinx-2.2.10-release

[root@centos7-2 sphinx-2.2.10-release]# ./configure --prefix=/usr/local/sphinx --with-mysql

[root@centos7-2 sphinx-2.2.10-release]# make && make install

安装依赖 libsphinxclient

[root@centos7-2 sphinx-2.2.10-release]# cd api/libsphinxclient

[root@centos7-2 libsphinxclient]# ./configure --prefix=/usr/local/sphinx

[root@centos7-2 libsphinxclient]# make && make install

但是等到安装PHP的sphinx模块的时候

需要下载支持php7 的sphinx模块,下载页面http://pecl.php.net/package/sphinx 中没有发现支持php7的模块。点击页面中的[ Browse Source ]

进入到页面发现php7的模块

我比较笨,使用浏览器下载tar.gz

然后继续

[root@centos7-2 src]# tar -zxvf sphinx-d958afb.tar.gz

[root@centos7-2 src]# cd sphinx-d958afb/

[root@centos7-2 sphinx-d958afb]# phpize

Can't find PHP headers in /usr/include/php

The php-devel package is required for use of this command.

出现报错信息发现未安装php-devel

[root@centos7-2 sphinx-d958afb]# yum install php71w-devel

[root@centos7-2 sphinx-d958afb]# phpize

Configuring for:

PHP Api Version:         20160303

Zend Module Api No:      20160303

Zend Extension Api No:   320160303

[root@centos7-2 sphinx-d958afb]# ./configure --with-php-config=/usr/bin/php-config --with-sphinx=/usr/local/sphinx/

[root@centos7-2 sphinx-d958afb]# make && make install

你可能感兴趣的:(sphinx)