在 Mac 上的 XAMPP 上安装 PHP 国际化扩展 (Intl) [英] Install PHP Internationalization extension (Intl) on XAMPP on Mac

查看:49
本文介绍了在 Mac 上的 XAMPP 上安装 PHP 国际化扩展 (Intl)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 OS X 上的 XAMPP 服务器上安装 Intl?

我尝试修改我的 XAMPP>etc>php.ini 并取消注释该行:

;extension=php_intl.dll

并重新启动 Apache,但没有成功.

解决方案

在 OSX 上安装intl"扩展.

  1. 通常,PHP 会自动安装在 OSX 上.因此,如果您想使用 XAMPP 或任何 apache 服务器,您必须将路径点更改为 XAMPP.您可以使用以下命令检查路径:

<块引用>

$哪个php

你应该得到

/Applications/XAMPP/xamppfiles/bin/php

如果没有,你会得到

<代码>/usr/bin/php.

这是 OSX 的 php.ini 文件.因此,您必须使用以下方法更改它:

<块引用>

$PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"

  1. 现在是安装 intl 的时候了.首先,你需要安装icu4c

<块引用>

$ brew install icu4c

它需要几次并返回它的路径给你,应该是这样的:

/usr/local/Cellar/icu4c/x.x.x

  1. 接下来,让我们使用 pecl 安装 intl

<块引用>

$ sudo pecl 更新频道

$ sudo pecl install intl

它会提示你输入 icu4c 路径.完成安装icu4c后,将以下语句放入php.ini

extension=intl.so

  1. 重启apache.并检查是否安装整齐.

<块引用>

$ php -m |grep intl

应该返回'intl'

就是这样!

How can I install Intl on my XAMPP server on OS X?

I tried modifying my XAMPP>etc>php.ini and uncommenting the line:

;extension=php_intl.dll

and restarting Apache, but it didn't work.

解决方案

Installing "intl" extension on OSX.

  1. Normally, the PHP is automatically installed on OSX. So, if you would like to use the XAMPP, or whatever apache server, you must change the path point to XAMPP. You can check the path by using:

$ which php

You should get

/Applications/XAMPP/xamppfiles/bin/php 

if not, you will get

/usr/bin/php. 

This is OSX' php. So, you have to change it by using:

$ PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"

  1. Now, it's time to install intl. Firstly, you need to install icu4c

$ brew install icu4c

It takes a couple of times and returns its path to you, should look something like this:

/usr/local/Cellar/icu4c/x.x.x 

  1. Next, let's install intl by using pecl

$ sudo pecl update-channels

$ sudo pecl install intl

It will prompt you to put the icu4c path. After finish installing icu4c, put the following statement to php.ini

extension=intl.so

  1. Restart apache. and check whether it's neatly installed.

$ php -m | grep intl

should return 'intl'

That's it!

这篇关于在 Mac 上的 XAMPP 上安装 PHP 国际化扩展 (Intl)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆