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

I am trying to run a regex on my site and I get this answer:

Compilation error: support \ P, \ p, and \ X is not compiled to offset 1

After a short search on Google, I found that my PCRE on my server does not seem to have UTF8 enabled and therefore causes problems. When I ssh with pcretest -C, I get

PCRE Version 6.6 06-Feb-2006

Compiled with support for UTF-8 No Support for Unicode properties Newline LF symbol Internal link size = 2 POSIX malloc threshold = 10
Default Compliance Limit = 10000000
Default recursion depth limit = 10000000 Match recursion uses stack

When I do yum update pcre, it tells me that there is nothing to update.

People tell me that I can enable UTF-8 support ... help?

I am noob.

+2
source share
3 answers

There is a good RPM recovery tutorial for pcre here .

If you go to the β€œUpdated RPM file for ...”, you will find some pre-configured RPM if you just want it to work (remember to restart Apache after you finish, and not just a graceful reboot).

Tl version; dr: recompile pcre with --enable-utf8 and --enable-unicode-properties

+2
source

Now Yum should find v6.6.6.el5_6.1 PCRE in its repositories, so doing yum update pcre solved the problem for me in Centos 5.

+3
source

PHP does not use pcre application / package. PCRE support is built into the PHP libraries. The error you get tells you that your PHP libraries have not been compiled with PCRE UTF-8 support.

You will need to recompile PHP using the appropriate static PCRE library built using the corresponding UTF-8 option.

+1
source

Source: https://habr.com/ru/post/912548/


All Articles