trie_filter 感词滤敏扩展
需要先安装libiconv
和libdatrie
。
安装libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -xzvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure
make
make install
错误解决:
vim libiconv-1.14/srclib/stdio.in.h
将698行代码:_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
替换为
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
安装libdatrie
wget ftp://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.4.tar.gz
tar -zxf libdatrie-0.2.4.tar.gz
cd libdatrie-0.2.4
./configure --prefix=/usr/local/libdatrie/
make ICONV_LIBS='/usr/local/lib/libiconv.so'
make install
安装trie_filter
wget https://github.com/wulijun/php-ext-trie-filter/archive/master.zip
unzip master.zip
cd php-ext-trie-filter-master/
#生成php配置
phpize
./configure --with-php-config=/www/server/php/71/bin/php-config --with-trie_filter=/usr/local/libdatrie/
make
make install
备注:php-config
路径在php的安装目录下面/bin/php-config
配置:
在php.ini
最后一行加入:
extension=trie_filter.so
重启php-fpm,然后用php -m
查看扩展