form1.cn
Make a little progress every day

Linux中php安装SCWS扩展

07th of March 2017 Linux Sphinx 2410

进入源码目录的 phpext/ 目录

# cd /scws-1.2.3/phpext
# /usr/local/php/bin/phpize #用phpize生成configure配置文件
# ./configure --with-php-config=/usr/local/php5/bin/php-config --with-scws=/usr/local/scwsphpext //configure操作
# make
# make install
Installing shared extensions:     /usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/  //完后返回的路径


打开php.ini 跳转到尾部,添加以下代码

[scws]
extension_dir = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/
extension = scws.so


重启php之后,查看phpinfo()是否有scws扩展


注:configure时提示错误:configure: WARNING: You will need re2c 0.13.4 or later if you want to

解释:需要Re2C 0.13.4版本或以上版本

解决方法

# wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz
# tar zxf re2c-0.16.tar.gz
# cd re2c-0.16
# ./configure
# make
# make install


注:configure时提示错误:configure: error: Please download and install scws from http://www.xunsearch.com/scws

 --with-scws=/usr/local/scwsphpext 其中 scwsphpext目录必须是scws的安装目录


PHP扩展方式使用scws中文分词

Linux编译安装SCWS中文分词系统