PCRE – Perl Compatible Regular Expressions
The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API. The PCRE library is free, even for building proprietary software.
Today I experience with this error warning “Warning: preg_match(): Compilation failed: this version of PCRE is compiled without UTF support” in DirectAdmin (CentOS 6.x x64bit)
same as Warning: preg_replace() [function.preg-replace]: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support at offset 0 in.
UTF8 support is no longer installed after the update from PHP Apache and PCRE, so I decide to write a memo to remind myself how to fix this.
1. Install Packages by Yum
yum -y install pcre pcre-devel;
2. Run Test if there are UTF support
It should look like this
3. Let’s check rebuild PHP by using custombuild
cd /usr/local/directadmin/custombuild; ./build update; ./build clean; mkdir -p custom/ap2; cp -rfp configure/ap2/configure.php5 custom/ap2/configure.php5; perl -pi -e 's/--with-gd \\/--with-gd \\\n\t--with-pcre \\/' custom/ap2/configure.php5;
4. Let’s edit configure.php5 before build PHP
Remove —> “–with-pcre-regex=/usr/local \” <— this is very important!
It should look like this.
5. Save and Build Both
the last thing we have to do now is build php and cross fingers, Hope it works 🙂
./build pcre; ./build php n;
Do let me know, if this is work for you.