在CentOS上升级PCRE

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

5 thoughts on “在CentOS上升级PCRE

  • 星期六 四月 16th, 2011 at 03:38
    Permalink

    再将 /lib/libpcre.so.0.0.1 改个名字,问题解决
    请问改个什么名字

    /lib/libpcre.so.0

    弄了半天都必须可以啊

    Reply
  • 星期五 四月 29th, 2011 at 09:49
    Permalink

    随便改什么名字,或者干脆删除了。
    因为我的系统在 /lib/ 和 /usr/lib/ 中都有,新版本是装在 /usr/lib/ 中,所以要把 /lib/ 下的版本给禁用或者删除了。

    Reply
  • Pingback: Fixing Shared PCRE Library on CentOS - Admins Goodies

  • 星期四 六月 18th, 2015 at 00:15
    Permalink

    Hi, How do you unlink the file /lib/libpcre.so.0 and.

    I need to link another file?

    Reply
    • 星期一 六月 22nd, 2015 at 16:43
      Permalink

      To unlink the symbolic link file:
      unlink /lib/libpcre.so.0

      I have libpcre.so.0 in both /lib/ and /usr/lib/ directory so I have to delete the one from /lib/ directory.

      Reply

发表评论

电子邮件地址不会被公开。 必填项已用*标注