install ext-zip for Mac

后端 未结 10 1877
野性不改
野性不改 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:06

    i know this thread has true answered, i do those with this approach :

    1. brew link php@7.3 it is showing hint to using
      echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.zshrc echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> ~/.zshrc

    2. in terminal, echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.zshrc enter

    3. in terminal, echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> ~/.zshrc enter

    4. next execution this : source ~/.zshrc

    5. execution which php the results must show /usr/local/opt/php@7.3/bin/php

    6. try again composer update, if show Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/Cellar/composer/1.9.2/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52 please change php.ini limit with memory_limit = -1

    7. try search php.ini, type in terminal /usr/local/opt/php@7.3/bin/php --ini , the results must show: Configuration File (php.ini) Path: /usr/local/etc/php/7.3 Loaded Configuration File: /usr/local/etc/php/7.3/php.ini Scan for additional .ini files in: /usr/local/etc/php/7.3/conf.d Additional .ini files parsed: /usr/local/etc/php/7.3/conf.d/ext-opcache.ini

    8. nano /usr/local/etc/php/7.3/php.ini, append memory_limit =-1,save

    9. restart php

    10. re-execution composer update.

    Hope my answer can help you.

    0 讨论(0)
  • 2020-11-29 02:07

    Following command fixed the issue on macOS Catalina

    brew link php@7.3 --force
    
    0 讨论(0)
  • 2020-11-29 02:07

    Instead of force linking you can also fix the problem in MacOS Catalina

    by adding the php binary path to your bash profile e.g.:

    echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/php@7.3/sbinbin:$PATH"' >> ~/.bash_profile
    
    0 讨论(0)
  • 2020-11-29 02:08

    This worked for me

    brew update brew install php@7.3 brew link php@7.3 brew link php@7.3 --force

    Hope it helps

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

    0 讨论(0)
  • 2020-11-29 02:14

    In my case I had to simply

    brew link --overwrite php
    
    0 讨论(0)
提交回复
热议问题