【问题标题】:Cakephp 3 updating to PHP7 gives an intl extension errorCakephp 3 更新到 PHP7 给出了一个 intl 扩展错误
【发布时间】:2017-03-05 14:17:28
【问题描述】:

我将我的服务器更新到 PHP7,现在 CakePHP 给出了这个错误:

Fatal error: You must enable the intl extension to use CakePHP. in /var/www/clients/client1/web1/web/ID/config/bootstrap.php on line 38

我安装了apt-get install -y php7.0-intl

翻遍了整个互联网,我将/etc/php/7.0/cli/php.ini更新为

[intl]
;intl.default_locale =
; This directive allows you to produce PHP errors when some error
; happens within intl functions. The value is the level of the error produced.
; Default is 0, which does not produce any errors.
intl.error_level = 0
intl.use_exceptions = 0

我确定它是在 ini 中加载的

/etc/php/7.0/cli/conf.d/20-intl.ini,

但是还是不行。

【问题讨论】:

  • 你试过 php -m 了吗?
  • 您在进行这些更改后是否重新启动了 Apache?
  • /etc/php/7.0/cli/conf.d/20-intl.ini,是php -m的输出。我什至重新启动。
  • 确定是Apache下PHP使用的ini文件吗?刚刚注意到它的路径中有“cli”,这可能表明命令行中的 PHP 使用的 ini 文件与 Web 服务器中的 PHP 不同。
  • 确实,这就是问题所在。感谢您发现这一点!

标签: cakephp-3.0 php-7 intl


【解决方案1】:

在您的 php.ini 文件中取消注释以下行;

;extension=php_intl.dll;

并做到:

extension=php_intl.dll;

【讨论】:

  • 我在 Debian 上,这个 dll 只适用于 Windows 不是吗?
  • 你在使用任何 xampp 或其他东西吗?
  • 不,这是一个 VPS。
  • 不管你有没有php.ini文件?
  • 如果不使用以下链接并按照我在上面回答中的建议进行操作..inmotionhosting.com/support/website/server-usage/…
【解决方案2】:

在终端试试这个:

   sudo apt-get install php7.0-intl

【讨论】: