Yohanes Nurcahyo
Yohanes Nurcahyo

Reputation: 621

How to update PCRE in CENTOS/Redhat 6

For installing Scribunto, a Mediawiki add ins, it requires at least PCRE version 8.1. But in CENTOS update, the maximum version is 7.8.

I compiled the source code version 8.33 successfully and with "pcretest -C" command, it is already version 8.33. But the phpinfo() has still the old PCRE 7.8.

How to point PCRE in php to the newest version?

Upvotes: 0

Views: 2111

Answers (1)

Kevin E
Kevin E

Reputation: 3286

Sigh.

I feel ya.

I can tell you that what finally worked for me was building PCRE from source and using FastCGI (the mod_fcgid package in CentOS 6) with a stanza like this in /etc/httpd/conf.d/php.conf:

<IfModule fcgid_module>
  SetEnv LD_PRELOAD /usr/local/lib/libpcre.so.1

  ScriptAlias /fcgi-bin/ /var/www/fcgi-bin/
  AddType application/x-httpd-fastphp .php
  Action application/x-httpd-fastphp /fcgi-bin/php-cgi

  <Directory /var/www/fcgi-bin/>
    # Allows /usr/bin/php-cgi to be symlinked here
    Options +FollowSymLinks
  </Directory>
</IfModule>

Here are a list of things I tried with the default "modular" PHP setup (php5_module) before giving up and resorting to FastCGI.

  • PassEnv LD_PRELOAD with LD_PRELOAD=/usr/local/lib/libpcre.so.1 defined in /etc/sysconfig/httpd.
  • SetEnv LD_PRELOAD /usr/local/lib/libpcre.so.1
  • LoadFile /usr/local/lib/libpcre.so.1

However, I was putting these directives inside VirtualHost sections, generally, so I won't rule out the possibility that order was the problem. That is, it's entirely possible that these directives would need to come before the PHP module was loaded, and I wasn't doing that. I was using an /etc/httpd/conf.d/php.conf and a vhosts.conf and generally trying not to sully the top-level config file while I was experimenting.

Eventually I ran out of patience and tried going the FCGI route, and that worked for me. If you're married to running PHP as a loadable module, then you may wish to try some of the above options with things like LoadFile specified in httpd.conf before the PHP DSO is loaded.

Upvotes: 1

Related Questions