How to Install Intl in PHP, Mac

To install the Intl library for PHP in Mac, you need to install brew first.

Install Brew For ICU

First, update the brew

brew update

Search the ice package name.

 brew search icu

You will find it like icu4c and install it.

brew install icu4c

Your icu4c path is

/usr/local/Cellar/icu4c/55.1

The version may not be the same. You can check the director at /usr/local/Cellar/icu4c/

After we got icu4c, we can install intl from the peel.

Install Pear

To install pear package, need to install Autoconf

brew install autoconf

Time to Install Pear

curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar

Configure and Install PEAR

You should now be at a prompt to configure PEAR.

  1. Type 1 and press return.
  2. Enter: /usr/local/pear
  3. Type 4 and press return.
  4. Enter: /usr/local/bin
  5. Press return

Install Intl

After install pear, you can install intl from peel.

$ sudo pecl update-channels
$ sudo pecl install intl

Config Php.ini

After installing the intl, you just need to enable on php.ini.

sudo vim /etc/php.ini

Add extension like the following.

extension=intl.so

type :wq (save and exit). After that, we need to restart the apache.

sudo apachectl restart

Now, you can check the intl library like following

php -m | grep intl # should return 'intl'

ref:

Gravatar Image
My name is Than Dana but I’d like to be called Dana. I’m 28 years old and a single man. I’m from Toungoo, Bago division. I live in Yangon for my job and work as Digital Marketing Executive @ Win Mobile World Co., Ltd. I stand as a professional in IT fields and have been sharing, inventing and advancing tech developments since about 2008.