Install intl PHP extension OSX High Sierra

前端 未结 12 998
予麋鹿
予麋鹿 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 04:57

    I find a solution.

    curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
    

    Then I copied intl.so from the installation to my extension directory, which is defined into my php.ini.

    0 讨论(0)
  • 2020-12-01 04:58

    try this

    brew install homebrew/php/php71-intl
    
    0 讨论(0)
  • 2020-12-01 05:01

    try this on Mac

    php -v
    sudo port install php7*-intl
    

    More information

    You can find port packages by this page https://www.macports.org/ports.php?by=name&substr=intl

    And you can install port through these steps: https://guide.macports.org/chunked/installing.macports.html

    curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.5.4.tar.bz2
    tar xf MacPorts-2.5.4.tar.bz2
    cd MacPorts-2.5.4/
    ./configure
    make
    sudo make install
    

    And change ~/.bash_profile

    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    

    If there is error, check following steps:

    check port

    sudo port list
    sudo port selfupdate
    sudo port search --name --glob 'php*'
    sudo port install php**-intl
    

    This page has more info about port usage: https://guide.macports.org/chunked/using.html

    0 讨论(0)
  • 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!

    0 讨论(0)
  • 2020-12-01 05:07

    In addition to what L. Grolleau says (run brew install php71-intl), paste the int.so path to the /php.ini at the end of the file:

    extension=/usr/local/Cellar/php71-intl/7.1.11_20/intl.so
    
    0 讨论(0)
  • 2020-12-01 05:08

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

    You need to link the installed PHP version by brew link php@7.1

    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.

    0 讨论(0)
提交回复
热议问题