Intl (Internationalization) Extension
[…] is a wrapper for » ICU library, enabling PHP programmers to perform » UCA-conformant collation and date/time/number/currency formatting in their scripts.
It is really useful, as, with it, you can, for example, manage currencies and money values in the simplest way possibile (examples at the end of this post).
It is also required by some advanced framework as Symfony to work with international values.
STEP 0: Before to start, verify your environment
Verify which version of PHP are you running in Terminal
Before you install ICU binaries, check that your Terminal is using the PHP binaries provided by MAMP.
Instead you have to install Intl both for the PHP used by Terminal – the one shipped with MacOSX – and for the PHP used by your browsers – the one shipped with MAMP. Yes, they are 2 separate binaries packages!
Verify you’ve Installed XCode and its Command Line Tools
Before you can install Intl binaries, you have to install xCode Command Line Tools.
Verify you’ve installed Autoconf
Install Autoconf so you can run the Intl installation (more about this later).
STEP 1: Download ICU binaries and uncompress them
Go to ICU Project download page and grab the latest version.
On the download page you’ll find binaries for the major platforms and the source code: be sure to download the source code, and NOT the binaries.
STEP 2: Compile the binaries
Now that you have the ICU binaries, you have to install them. So, move into the icu/source folder and compile and install the binaries:
This process may require some minutes and during the process you will be asked to provide the Admin password.
STEP 3: Install the ICU binaries
Now install the Intl binaries in PHP:
STEP 4: Add intl.so to your php.ini
Now the easy last part: activate your new Intl extension in your php.ini.
If you have configured you MacOSX Terminal to use the same PHP binaries of MAMP, then you have to go to /Applications/MAMP/bin/php/phpX.X.X/conf/php.ini.
To know which php.ini your Terminal is using, type in Terminal itself:
So, open it with your favorite editor and find the line ; Extensions.
At the end of the section simply add the line extension=intl.so.
Now, save the php.ini and restart MAMP and verify that Intl extension is properly loaded:
and, if you like, check also
Now you have Intl library installed and working on your MAMP installation!