Some PHP libraries that support internationalization depends on PHP intl extension. Somehow, intl extension is not installed by default. This article will show you how to install the intl extension. It has been tested well on OS X Yosemite with PHP 5.5.
1) Prerequisite
2) Install ICU Libraries via Homebrew
ICU is shorthand for International Component for Unicode. You can check the site here. We have to install this first.
$ brew update
$ brew install icu4c3) Install Intl Extension via PECL
$ sudo pecl update-channels
$ sudo pecl install intlYou will be prompted in terminal the path where the extension is installed. Mine was
/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/intl.soHere is my terminal screenshot after installation done.
Attention! You will probably get this error below when install intl
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.54.dylib
Referenced from: /usr/local/bin/php
Reason: image not foundAs solution, you need to execute the following command
$ brew upgrade php55Then try to install intl again.
4) Add Intl Extension to php.ini
Check where your php.ini location is
$ php --iniOpen your php.ini and add the following line at bottom of file with your intl.so extension path (see its path on step 2)
extension=your-intl.so-extension-pathIn my system, it was
extension=/usr/local/Cellar/php55/5.5.19/lib/php/extensions/no-debug-non-zts-20121212/intl.soSave and quit the file
5) Restart Apache
After making changes on php.ini file, you need to restart apache.
$ sudo apachectl restart6) Check the installation
There are two ways to check if our intl installation is success. First is using the following command
$ php -m | grep intlThe second way using phpinfo()
Summary
We are done installing intl extension for PHP. :)


