PCRE – Perl Compatible Regular Expressions
今天在服务器上安装微博,出现错误:
PHP is linked to a version of the PCRE library that does not support Unicode properties. If you are running Red Hat Enterprise Linux / CentOS 5.4 or earlier, see our documentation page on fixing this.
但我的服务器已经是 CentOS 5.5 了
登录服务器检查:
# pcretest -C
PCRE version 6.6 06-Feb-2006
Compiled with
UTF-8 support
No Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
果然PCRE库不支持 unicode 属性。
重新下载了最新版的 PCRE库,运行
./configure –prefix=/usr –enable-utf8 –enable-unicode-properties
make
make install
再次检查系统:
# pcre-config –version
8.10
看起来好像成功了。但是,
# pcretest -C
PCRE version 6.6 06-Feb-2006
Compiled with
UTF-8 support
No Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
怎么还是 6.6 的旧版本?pcre-config 和 pcretest 显示的版本竟然会不一样。
上网Google了很久,才发现问题的根源:
原来在 /lib/ 目录库中还有两个不同的版本
# locate libpcre
> > /lib/libpcre.so.0
> > /lib/libpcre.so.0.0.1
> > /usr/lib/libpcre.a
> > /usr/lib/libpcre.la
> > /usr/lib/libpcre.so
> > /usr/lib/libpcre.so.0
先 unlink /lib/libpcre.so.0
再将 /lib/libpcre.so.0.0.1 改个名字,问题解决
# pcretest -C
PCRE version 8.10 2010-06-25
Compiled with
UTF-8 support
Unicode properties support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack