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