PHP Runs an Old Version of PCRE Causing Problems with Drupal and MediaWiki

This seems to happen a lot – and it took several searches and many pages of reading to find the solution. This page will try to even the odds a little more.

The solution was found here: PCRE Problem Appearing in PHP Related to Apache Webserver

After building a new Apache, then a new PHP, and configuring both, Drupal started throwing error messages “Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support”.

The problem, as noted above, is a little like “DLL Hell” in Windows. There are two versions of PCRE on the system. One is in /usr/local/lib, and when you run “pcretest -C” you see that one. Another is embedded in Apache, and is an older version. When PHP uses PCRE, it gets linked to the one in Apache.

The fix is to recompile Apache with the external PCRE library – so that Apache won’t compile an internal version of PCRE. Once installed, the PHP will use the shared version (the latest version) of PCRE.

On my system, the configure option was –with-pcre=/usr/local