php5.6 centos7.1中运行出现:
preg_match(): Compilation failed: this version of PCRE is compiled without UTF support at offset 0
原因:
pcre编译有问题,pcre7.9以上的版本,默认是不支持Unicode、UTF-8的,要重新编译手动指定 –enable-utf8
查看pcre版本:
pcretest -C
解决方法:
PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括perl兼容的正则表达式库。这些在执行正则表达式模式匹配时用与Perl 5同样的语法和语义是很有用的,也可以来解决C语言中使用正则表达式的问题。
重新编译安装pcre:
1、下载pcre-8.38.tar.gz
2、解压
# tar zxvf pcre-8.38.tar.gz # cd pcre-8.38
3、编译安装(指定:–enable-utf8 –enable-unicode-properties )
# ./configure --enable-utf8 --enable-unicode-properties # make # make install