Ubuntu 安装php_intl 扩展

PHP Intl 类在I18n的网站中真的很方便,允许你依赖在终端用户区域,很容易的输出正确的日期格式。 

在使用 yii2-app-ecom , 初始化之后,访问首页出现了:

The default currency code for the formatter is not defined.

看了issue The default currency code for the formatter is not defined #7 ,说要安装php_intl 扩展。

安装可以通过:

sudo apt-get install php_intl

安装完之后,记得重启Apache

sudo service apache2 restart

你可以检查那些扩展是运行

php -m

当然也可以使用php 代码的形式检查intl是否允许

var_dump(extension_loaded('intl'));

文章参考链接:

  1. UBUNTU: ENABLING THE PHP INTL EXTENSION

  2. Install PECL packages on ubuntu (以为要安装pecl,但是到最后一步,安装失败,需要PHP 版本 >= 7.0)

原文地址:https://www.cnblogs.com/fsong/p/5468119.html