# 安装libiconv
这个是libdatrie的依赖项
```
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar zxvf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure
make
make install
//查看版本
iconv --version
如果报 iconv: error while loading shared libraries: libiconv.so.2
ldconfig
```
# 安装libdatrie
最新版本下载站点
https://github.com/tlwg/libdatrie/releases
```
wget https://github.com/tlwg/libdatrie/releases/download/v0.2.12/libdatrie-0.2.12.tar.xz
tar xvJf libdatrie-0.2.12.tar.xz
cd libdatrie-0.2.12
./configure --prefix=/usr/local/libdatrie LDFLAGS=-L/usr/local/lib LIBS=-liconv
make
make install
```
# 安装trie-filter扩展
```
git clone https://github.com/zzjin/php-ext-trie-filter
cd php-ext-trie-filter
phpize
./configure --with-php-config=/alidata/server/php/bin/php-config --with-trie_filter=/usr/local/libdatrie
make
make install
```
在php.ini文件最后加上extension=trie_filter.so,保存配置并重启php