Upgrade PCRE on CentOS

PCRE – Perl Compatible Regular Expressions

I was trying to install an application on server today and received the following error message:

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.

The CentOS version is 5.5.

SSH to the server and check version:

# 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

It shows Unicode is not supported by PCRE library

I have to download the latest PCRE library and run

./configure –prefix=/usr –enable-utf8 –enable-unicode-properties
make
make install

check the system again:

# pcre-config –version
8.10

Great! but…

# 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

Why it still shows the old version 6.6? The output from pcre-config and pcretest are different.

Finally found an answer with Google: The old library was still in folder /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

First unlink /lib/libpcre.so.0
Then rename /lib/libpcre.so.0.0.1 to something else (or just delete it)
problem resolved

# 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 “Upgrade PCRE on CentOS

  • Saturday April 16th, 2011 at 03:38
    Permalink

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

    /lib/libpcre.so.0

    弄了半天都必须可以啊

    Reply
  • Friday April 29th, 2011 at 09:49
    Permalink

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

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

  • Thursday June 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
    • Monday June 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

Leave a Reply to Chse Cancel reply

Your email address will not be published. Required fields are marked *