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
i know this thread has true answered, i do those with this approach :
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
in terminal, echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.zshrc
enter
in terminal, echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> ~/.zshrc
enter
next execution this : source ~/.zshrc
execution which php
the results must show /usr/local/opt/php@7.3/bin/php
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
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
nano /usr/local/etc/php/7.3/php.ini
, append memory_limit =-1,save
restart php
re-execution composer update.
Hope my answer can help you.
Following command fixed the issue on macOS Catalina
brew link php@7.3 --force
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
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
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
In my case I had to simply
brew link --overwrite php