Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP PCRE (regex) doesn't support UTF-8?

Tags:

regex

php

ssh

pcre

I am attempting to run a regex on my site, and I am getting this response:

Compilation failed: support for \P, \p, and \X has not been compiled at offset 1

After googling for a bit, I've found that apparently my PCRE on my server is not UTF8 enabled, and is therefore causing problems. When I ssh with pcretest -C I get

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

When I do yum update pcre it tells me that there isn't anything to update.

People are telling me that I can turn on UTF-8 support...help?

I am a noob.

like image 497
johnnietheblack Avatar asked Dec 05 '25 10:12

johnnietheblack


2 Answers

There's a good tutorial on rebuilding the RPM for pcre here.

If you scroll down to "Updated RPM file for..." you'll find some pre-built RPM's if you just want it to work (remember to restart Apache after you're done, not just a graceful reload).

The tl;dr version is: recompile pcre with --enable-utf8 and --enable-unicode-properties

like image 133
Owen Avatar answered Dec 07 '25 01:12

Owen


Yum should now find v6.6.6.el5_6.1 of PCRE in its repositories, so performing a yum update pcre resolved the issue for me on Centos 5.

like image 25
Jonathan Day Avatar answered Dec 07 '25 01:12

Jonathan Day