install ext-zip for Mac

后端 未结 10 1933
野性不改
野性不改 2020-11-29 02:00

I am trying to run composer update and I get the following errors:

Problem 1
    - The requested PHP extension ext-zip * is missing from your sy         


        
10条回答
  •  星月不相逢
    2020-11-29 02:09

    If brew link is not working for you, check your php version installed by:

    ls /usr/local/opt/php*
    

    Here, you will see a version as such:

    /usr/local/opt/php@7.3/bin:$PATH
    

    Should give you an output like:

    /usr/local/opt/php@7.3:
    INSTALL_RECEIPT.json        include
    LICENSE                     lib
    NEWS                        pecl
    README.md                   sbin
    bin                         share
    homebrew.mxcl.php@7.3.plist
    

    Now you just need to link that to your $PATH which can be done as:

    echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.zshrc
    echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    

    Note: I am using .zshrc because that is my terminal setup. If yours is bash, use accordingly.

    You can check which version of php is now linked to your MacOS by running:

    which php
    

    This should give you an output of:

    /usr/local/opt/php@7.3/bin/php
    

    That's it. Now if you try composer update, it should not give you the extension issue.

    Source (part of it): https://medium.com/@jjdanek/installing-php-extensions-on-mac-after-homebrew-acfffffd6be602

提交回复
热议问题