Install intl PHP extension OSX High Sierra

Mondy picture Mondy · Oct 9, 2017 · Viewed 76.8k times · Source

How can I install intl PHP extension in PHP 7.1.7, which is delivered with osx high sierra?

Answer

Steven667 picture Steven667 · Jul 10, 2018

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!