Install intl PHP extension OSX High Sierra

前端 未结 12 1031
予麋鹿
予麋鹿 2020-12-01 04:39

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

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 05:07

    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 php@7.1

    Upgrade it to latest version

    brew upgrade php@7.1

    Symlinks for references in Cellar:

    brew link --overwrite --force php@7.1

    Change PHP path in my bash profile

    echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/php@7.1/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!

提交回复
热议问题