Onex ecstore scw1.2.3 安装(含php扩展)
ecstore安装scw(2016/11/27最新教程)
1.首先,下载http://www.ftphp.com/scws/download.php
CentOS6.5安装为例:
wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2
tar xvjf scws-1.2.3.tar.bz2
mkdir /usr/local/scws
cd /usr/local/source/scws-1.2.3
./configure --prefix=/usr/local/scws
注:这里和通用的 GNU 软件安装方式一样,具体选项参数执行 ./configure --help 查看。
常用选项为:--prefix=<scws的安装目录>
make&&make install
2. 顺利的话已经编译并安装成功到 /usr/local/scws 中了,执行下面命令看看文件是否存在
ls -al /usr/local/scws/lib/libscws.la
/usr/local/scws/bin/scws -h
//scws (scws-cli/1.2.2)
//Simple Chinese Word Segmentation - Command line usage.
//Copyright (C)2007 by hightman.
3.安装php扩展
cd phpext/
/usr/local/php/bin/phpize
./configure --with-scws=/usr/local/scws --with-php-config=/usr/local/php/bin/php-config
make && make install
vim /usr/local/php/php.ini
[scws]
extension = scws.so scws.default.charset = utf8 scws.default.fpath = /usr/local/scws/etc
重启php后执行php -m 即可查看scws
4.安装字典库
cd /usr/local/scws/etc/
wget http://www.xunsearch.com/scws/down/scws-dict-chs-gbk.tar.bz2
tar xvjf scws-dict-chs-gbk.tar.bz2
wget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2
tar xvjf scws-dict-chs-utf8.tar.bz2
5.注意:scws只能单机部署,如果是集群部署每台web机都需要部署scws
ecstore config.php配置scws词典调用路径(去掉注释)
vim config.php
#scws 词典目录 编码默认为utf8
#如果是集群部署,词典路径需一致,或者词典放在同步目录里面调用
#define('SCWS_DICT','/usr/local/scws/etc/dict.utf8.xdb');
#define('SCWS_RULE','/usr/local/scws/etc/rules.utf8.ini');