gpt4 book ai didi

PHP PCRE(正则表达式)不支持 UTF-8?

转载 作者:可可西里 更新时间:2023-11-01 00:27:46 26 4
gpt4 key购买 nike

我试图在我的网站上运行一个正则表达式,我收到了这样的回复:

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

谷歌搜索了一下后,我发现我服务器上的 PCRE 显然没有启用 UTF8,因此导致了问题。当我使用 pcretest -C ssh 时,我得到了

PCRE 6.6 版 2006 年 2 月 6 日

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

当我执行 yum update pcre 时,它​​告诉我没有要更新的东西。

人们告诉我可以打开 UTF-8 支持...求助?

我是菜鸟

最佳答案

有一个关于为 pcre 重建 RPM 的好教程 here .

如果你向下滚动到“Updated RPM file for...”,如果你只是想让它工作,你会发现一些预构建的 RPM(记住在你完成后重新启动 Apache,而不仅仅是优雅地重新加载) .

tl;dr 版本是:使用 --enable-utf8--enable-unicode-properties 重新编译 pcre

关于PHP PCRE(正则表达式)不支持 UTF-8?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2106889/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com