ITPub博客

首页 > IT职业 > IT图书 > php扩展trie_filter的实践

php扩展trie_filter的实践

IT图书 作者:tzhang911 时间:2021-09-09 09:17:36 0 删除 编辑

trie_filter是屏蔽敏感词的非常有用的扩展。以下是我的实践。

ubuntu1404 + php5.3.29 + libiconv-1.13.1 + libdatrie


  1. 安装libiconv

    wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

    tar zxvf libiconv-1.13.1.tar.gz

    cd libiconv-1.13.1

    ./configure –prefix=/usr/local

    make
    make install

  2. 安装libdatrie

    sudo apt-get update

    sudo apt-get install libdatrie-dev

3. 下载php5.3.29包编译

    ./configure --with-iconv=/usr/local/lib

4. 获取trie_filter扩展包

 git clone https://github.com/wulijun/php-ext-trie-filter.git

 编译

$ $INSTALL_PHP_PATH/bin/phpize$ ./configure --with-php-config=$INSTALL_PHP_PATH/bin/php-config --with-trie_filter=$LIB_PATH$ make$ make install

5.测试

 php -m | grep trie_filter

 php -r "var_dump(function_exists('trie_filter_save'));"

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1926/viewspace-2801814/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-16

  • 博文量
    100
  • 访问量
    752