How can I install intl PHP extension in PHP 7.1.7, which is delivered with osx high sierra?
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.
php file extension refers to the name of a file with a PHP script or source code that has a ". PHP" extension at the end of it. It's similar to a Word file with a . doc file extension.
So I had the exact same issue. As noted by other folks commenting here, High Sierra comes with PHP 7.1 installed and this PHP version has intl compiled with it
In my case, I followed part of Neodork comment's in the following Valet+ issue:
"Install" PHP 7.1 (so it comes from brew itself, not the one installed by High Sierra)
brew install [email protected]
Upgrade it to latest version
brew upgrade [email protected]
Symlinks for references in Cellar:
brew link --overwrite --force [email protected]
Change PHP path in my bash profile
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile
Reload your bash profile (you can close the terminal and open it again)
. ~/.bash_profile
Check for Intl
php -m | grep intl
Note: If you come across with warnings like:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so'
Then you have to disable the previous intl:
mv /usr/local/etc/php/7.1/conf.d/ext-intl.ini /usr/local/etc/php/7.1/conf.d/ext-intl.ini.disabled
Hope it helps!
After the integration from brew/php
to brew/core
, the intl
extension is included by the default installation. I also had the same problem the intl
extension wasn't working. The problem I had was the command-line environment was not using the installed version of PHP but the default version from macOS system.
To enable the installed version, you need to do this:
After brew install [email protected]
You need to link the installed PHP version by brew link [email protected]
Then you need to OPEN A NEW TERMINAL to make it effective.
Then double check the PHP binary path, which php
make sure it's /usr/local/bin/php
instead of /usr/bin/php
Then check if the intl extension is enabled, php -m | grep intl
It works for me.
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