Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install PHP Internationalization extension (Intl) on XAMPP on Mac

Tags:

php

macos

xampp

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.

like image 703
Shubham Tiwari Avatar asked Jan 04 '16 18:01

Shubham Tiwari


People also ask

What is PHP Intl extension?

The Internationalization extension (Intl) is a wrapper for the ICU library, a set of C/C++ and Java libraries that provide Unicode and Globalization support for software applications. It enables PHP programmers to perform UCA-conformant collation and date/time/number/currency formatting in their scripts.


2 Answers

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!

like image 189
Shubham Tiwari Avatar answered Sep 21 '22 08:09

Shubham Tiwari


On OSX if you have homebrew available and have PHP7:

$ brew install php70-intl // For PHP7.0
$ brew install php71-intl // For PHP7.1

For PHP5.5:

$ brew install php55-intl

Re-open your terminal window to ensure it works right in your session. To see if it loaded via your CLI interpreter:

$ php -m | grep intl

Or:

$ php -i "(command-line 'phpinfo()')" | grep intl

Source: https://daveismyname.blog/blog/install-php-intl-on-mac-using-homebrew

like image 43
HongPong Avatar answered Sep 19 '22 08:09

HongPong