Server Side

Server related posts

Upgrading PCRE From 7.8 to 8.13 on a Centos 6.3 VPS

Written by: Peter Fisher on June 3, 2014
Tagged under: , , ,
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

A simple guide to upgrading PCRE from 7.8 to 8.13 on a Centos 6.3 VPS.

Linux penguin Tux

This is actually relatively painless processes

We check the current version installed and what is running with PHP. We then remove the existing PCRE package whilst leaving any dependencies. After that we add a new repository and install the the version of PCRE. Finally we check the installed version and the the version used with PHP.

Check which version you have now:

# pcretest -C
PCRE version 7.8 2008-09-05
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

Check which version is used in PHP

# php -i | grep PCRE
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 7.8 2008-09-05

Search for all rpms of PCRE

# rpm rpm -q --queryformat "%{name}.%{arch}\n" pcre
rpm.x86_64
pcre.x86_64

Remove legacy version of PCRE leaving all dependences

# rpm -ev --nodeps pcre

Add a new rpm repository

# nano /etc/yum.repos.d/utter-ramblings.repo

Include the following

[utter-ramblings]
name=Utter Ramblings
baseurl=http://www.jasonlitka.com/media/EL5/x86_64/
gpgkey=#same.url.as.above#/media/RPM-GPG-KEY-jlitka
enabled=1
gpgcheck=1

Install only the pcre package

# yum --disablerepo=* --enablerepo=utter-ramblings install pcre pcre-devel
Loaded plugins: fastestmirror, priorities
Determining fastest mirrors
utter-ramblings                                          | 2.3 kB     00:00 ... 
utter-ramblings/primary_db                               | 112 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pcre.x86_64 0:8.13-1.jason.2 will be installed
---> Package pcre-devel.x86_64 0:8.13-1.jason.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch         Version              Repository             Size
================================================================================
Installing:
 pcre             x86_64       8.13-1.jason.2       utter-ramblings       562 k
 pcre-devel       x86_64       8.13-1.jason.2       utter-ramblings       438 k

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 3.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): pcre-8.13-1.jason.2.x86_64.rpm                    | 562 kB     00:01     
(2/2): pcre-devel-8.13-1.jason.2.x86_64.rpm              | 438 kB     00:01     
--------------------------------------------------------------------------------
Total                                           369 kB/s | 1.0 MB     00:02     
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 0d4306ef: NOKEY
Retrieving key from http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
Importing GPG key 0x0D4306EF:
 Userid: "Jason Litka (http://www.jasonlitka.com) <jasonlitka@verizon.net>"
 From  : http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 10 pre-existing rpmdb problem(s), 'yum check' output follows:
grep-2.6.3-3.el6.x86_64 has missing requires of libpcre.so.0()(64bit)
httpd-2.2.15-30.el6.centos.x86_64 has missing requires of libpcre.so.0()(64bit)
httpd-tools-2.2.15-30.el6.centos.x86_64 has missing requires of libpcre.so.0()(64bit)
less-436-10.el6.x86_64 has missing requires of libpcre.so.0()(64bit)
php-5.3.3-27.el6_5.x86_64 has missing requires of libpcre.so.0()(64bit)
php-cli-5.3.3-27.el6_5.x86_64 has missing requires of libpcre.so.0()(64bit)
2:postfix-2.8.4-12052415.x86_64 has missing requires of pcre
2:postfix-2.8.4-12052415.x86_64 has missing requires of libpcre.so.0()(64bit)
psa-mail-driver-common-11.0.9-cos6.build110120608.16.x86_64 has missing requires of libpcre.so.0()(64bit)
sw-cp-server-1.0-8.201205141805.centos6.x86_64 has missing requires of libpcre.so.0()(64bit)
  Installing : pcre-8.13-1.jason.2.x86_64                                   1/2 
  Installing : pcre-devel-8.13-1.jason.2.x86_64                             2/2 
  Verifying  : pcre-devel-8.13-1.jason.2.x86_64                             1/2 
  Verifying  : pcre-8.13-1.jason.2.x86_64                                   2/2 

Installed:
  pcre.x86_64 0:8.13-1.jason.2        pcre-devel.x86_64 0:8.13-1.jason.2       

Complete!

Finally check if you have the new version

# pcretest -C
PCRE version 8.13 2011-08-16
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

Check that PHP has been updated to use the new version

# php -i | grep PCRE
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 8.13 2011-08-16
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Peter Fisher is a web developer working in Gloucester UK. Founder of the digital agency Websomatic, author of this blog and the HowToCodeWell Youtube channel. Peter has over ten years of web development experience under his belt

Read all about Peter Fisher

Leave a Reply

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

3 Responses

ENRICO says:

I LOVE YOU!!

paolo says:

Hi peter,
thank for this tutorial … easy and it works!

thanks a lot
Paolo

Peter Fisher says:

No Problem Palo. Glad I could help