在 mac 中安装 PHP INTL 不正确

Installing PHP INTL in mac not getting it right

我已经使用 Homebrew 安装了 php56-intl,如下所示:brew install php56-intl 当我做 php -m | grep intl 它给了我 intl

但是当我签入 phpinfo() 文件时,没有显示 intl

不确定我错过了什么。

更新

我只想在我的计算机上安装 intl,这样我就可以 运行 我的 zend 应用程序。但无论我做什么,我都没有完成。

An error occurred An error occurred during execution; please try again later.

Additional information:

Zend\I18n\Exception\ExtensionNotLoadedException File: /Applications/XAMPP/xamppfiles/htdocs/skeleton/vendor/zendframework/zend-i18n/src/Filter/AbstractLocale.php:24

Message:

Zend\I18n\Filter component requires the intl PHP extension

问题是,intl 安装在我的 mac 而不是 XAMPP。

好吧,在这里折腾了很久,我是如何成功的:

转到您的终端并

cd /Applications/XAMPP/bin

然后 php -m | grep intl,如果它 return 是你 intl 那么它就被安装了。如果没有安装那么应该 return empty.

现在,sudo ./pecl install intl

将询问 specify where ICU libraries and headers can be found,只需按回车键,

这将安装 intl,还将 return 此消息 You should add "extension=intl.so" to php.ini

所以只需将它添加到您的 php.ini 文件并重新启动您的 apache:sudo apachectl restart 或从 XAMPP 本身硬重启。

希望这对其他人有帮助。

我在使用 OsX 默认值 php 并且没有国际扩展时遇到了类似的问题。这就是解决我的问题的方法:

  1. brew install php56(确保你安装了 hombebrew)
  2. 在你的 httpd.conf 中找到行 LoadModule php5_module libexec/apache2/libphp5。所以,评论它
  3. 在该行下方添加:LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5。因此,对于您的情况,只需更改 php53到 php54.