标签:bsp wget pkill scws phpize etc 词典 local har
mkdir scws cd scws wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2 tar xvjf scws-1.2.3.tar.bz2 cd scws-1.2.3 ./configure --prefix=/usr/local/scws make && make install
# 下载字典
cd /usr/local/scws/etc wget http://www.xunsearch.com/scws/down/scws-dict-chs-gbk.tar.bz2 wget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2 tar xvjf scws-dict-chs-gbk.tar.bz2 tar xvjf scws-dict-chs-utf8.tar.bz2
# 编译php扩展
cd /root/scws-1.2.3/phpext phpize ./configure --with-scws=/usr/local/scws --with-php-config=/usr/local/php/bin/php-config make && make install
# 在 php.ini 中加入以下几行
[scws] extension=scws.so scws.default.charset=gbk scws.default.fpath=/usr/local/scws/etc
# 重启php
pkill php-fpm
/usr/local/php/sbin/php-fpm
# 在php程序中用 ini_get(‘scws.default.fpath‘) 读取scws.default.fpath目默认字典录设置
# 测试分词程序
php /root/scws-1.2.3/phpext/scws_test.php //如果运行失败,很可能是未正确指定词典路径
标签:bsp wget pkill scws phpize etc 词典 local har
原文地址:https://www.cnblogs.com/two-bees/p/10763996.html