【问题标题】:PHP8 - APCuIterator::__construct(): Regular expressions support is not enabled, please enable PCRE for APCuIterator regex supportPHP8 - APCuIterator::__construct(): 正则表达式支持未启用,请为 APCuIterator 正则表达式支持启用 PCRE
【发布时间】:2021-07-13 13:42:31
【问题描述】:

我已将我们的 Docker 映像从 PHP7.4 升级到 PHP8,现在每次请求都会出现此错误:

APCuIterator::__construct(): Regular expressions support is not enabled, please enable PCRE for APCuIterator regex support.

我们正在使用 Symfony,它正在调用 new APCuIterator()。为了单独重现这一点,我为 CLI 启用了 apcu,然后我自己调用了构造函数:

$ vim /etc/php/8.0/mods-available/apcu.ini
apc.enable_cli=1


$ php -a
Interactive mode enabled

php > new APCuIterator('whatever');
PHP Fatal error:  APCuIterator::__construct(): Regular expressions support is not enabled, please enable PCRE for APCuIterator regex support. in php shell code on line 1

虽然启用了 PCRE,但preg_match() 可以正常工作。


禁用 APCu 似乎可以解决问题,但这不是“解决方案”:

# /etc/php/8.0/mods-available/apcu.ini

# extension=apcu.so  <-- comment this out

我很困惑,因为在 Google 上这个错误消息实际上是不匹配的。

【问题讨论】:

    标签: php apcu


    【解决方案1】:

    原来这是一个版本问题。我安装的 APCu 5.1.17 失败了。

    升级到 APCu 5.1.20 修复了它。

    【讨论】:

      猜你喜欢
      • 2013-02-24
      • 2011-04-02
      • 1970-01-01
      • 1970-01-01
      • 2014-05-15
      • 1970-01-01
      • 2012-11-12
      • 2017-12-02
      相关资源
      最近更新 更多