I'm following this link to install this PHP extension but I'm stuck in the middle.
When I try to run this command pecl install intl
I get this message:
Specify where ICU libraries and headers can be found [DEFAULT] :
And I don't know where the ICU libraries are located.
If I press Enter I get this error:
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
ERROR: `/private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed
How can I locate the correct path of ICU libraries ? I'm using High Sierra and MAMP with PHP version 7.1
Installation on macOS ¶PHP is bundled with macOS since macOS X (10.0. 0) prior to macOS Monterey (12.0. 0).
download the version of PHP you use in XAMPP from php.net. I am using 7.3. This version worked for me: php-7.3, I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz cd into the extracted folder
cd php-7.1.31 change to subfolder ext/intl
cd ext/intl/ Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
That’s it! Restart your Apache using XAMPP GUI and it should work. You have to run these commands each time you install a new version of XAMPP.
ICU stands for ICU - International Components for Unicode
Install it with brew
brew update
brew search icu # returns 'icu4c'
brew install icu4c
OR
Install it with pecl
sudo pecl update-channels
sudo pecl install intl
installing intl package on osx
EDIT: after a better look in [email protected] it seems that it is already compiled with 'intl'
php -i | grep intl
... '--enable-intl' ...
So my answer is normally useless for [email protected] (but can be useful in some cases I guess)
I'm facing the same issue today trying to switch from php56 to [email protected].
After lot of digging, here is the workaround.
Make sure to have a clean install of [email protected] and to have it at the current version
php -v
PHP 5.6.35 (cli) (built: Mar 31 2018 20:21:31)
Make also sure to have icu4c
brew update
brew install icu4c
Next, we will install and compile intl manually
cd /usr/local/src/
wget https://pecl.php.net/get/intl-3.0.0.tg
tar zxf intl-3.0.0.tgz
cd intl-3.0.0/
phpize --clean
phpize
./configure
And here is the trick, edit Makefile
vi Makefile
Modify the line CXXFLAGS
as follow
CXXFLAGS = -g -O2 -std=c++11
AND the line CPPFLAGS
as follow
CPPFLAGS = -DHAVE_CONFIG_H -DU_USING_ICU_NAMESPACE=1
Next, save, and compile
make
make install
And voila
Installing shared extensions: /usr/local/Cellar/[email protected]/5.6.35/pecl/20131226/
Don't forget to add extension="intl.so"
to your php.ini
vi /usr/local/etc/php/5.6/php.ini
(and to restart apache)
Sources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With