4


I wanted to update my Laravel app's dependencies using composer, but while entering composer update I receive an error for one of the dependencies ***** requires ext-zip * -> the requested PHP extension zip is missing from your system.
I check the installed PHP for the extensions and this is the output of php -m:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

As I checked the zip extension is already available to the command line and the to the application but the composer is not updating. Can anyone guide me?
OS: macOS Catalina
Server: MAMP Pro

Esmatullah Arifi
  • 812
  • 3
  • 12
  • 24
  • Possible duplicate of [Can't install laravel installer via composer](https://stackoverflow.com/questions/46058457/cant-install-laravel-installer-via-composer) – Don't Panic Sep 07 '19 at 08:58
  • The question is eventually not a duplicate as the OP is asking for a solution on **macOS** and not **Ubuntu**. – Nicolai Fröhlich Sep 07 '19 at 12:28
  • Are you sure you don't have multiple PHP versions on your system? This happens quite easily on a Mac as it comes with a pre-installed PHP that is quite old. You can make sure that your "default" php that you checked the modules for is used by calling composer with it. This requires the exact composer location though. For example it could look like this: `php /usr/local/bin/composer update`. If that works you can try to figure out where the other installation is and either remove it or make sure composer doesn't use it, e.g. by changing your PATH environment variable. – dbrumann Sep 07 '19 at 13:48
  • Did you ever figure this out? – Robert Cordes Oct 26 '19 at 13:12

1 Answers1

-1

In case someone is looking for an answer, it's simple. Edit you .profile with vim ~/.profile ( you can use others too, like mate if using TextMate), add the line as last line: alias composer='php /usr/local/bin/composer'. Save the file and restart your terminal, or reload the profile. That's it