Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

macos - Install PHP Internationalization extension (Intl) on XAMPP on Mac

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...