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 system. Install or enable PHP's zip extension.
Problem 2
- maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.11 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.12 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.13 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.14 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.15 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.16 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.17 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.7 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.8 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.9 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.x-dev requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.2.x-dev requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.0 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.1 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.2 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.3 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.4 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.5 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.6 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- phpoffice/phpspreadsheet 1.9.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.8.2 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.8.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.8.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.7.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.6.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.5.2 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.5.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.5.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- phpoffice/phpspreadsheet 1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for maatwebsite/excel ^3.1.0 -> satisfiable by maatwebsite/excel[3.1.0, 3.1.1, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.16, 3.1.17, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9, 3.1.x-dev, 3.2.x-dev].
when running composer update
Overnight I have made the mistake of my life and allowed my Mac to automatically update the OS, so I am in macOS Catalina now.
I have tried adding
"require": {
"ext-zip": "*",
}
to my composer.json..but its not downloading that extension.
php-zip
extension installed.
I had the same problem after updating my Mac to Catalina. Here is what worked for me.
brew update
brew install php@7.3
brew link php@7.3
Then reload your console.
It will install php 7.3.10 with zip module. You can use php -v to check for the version, and php -m for the modules.
Following command fixed the issue on macOS Catalina
brew link php@7.3 --force
On 10 March 2020, It works for me:
brew install php
It is the only one command about PHP which work. So, I think that the commands shown in the last posts are deprecated.
brew unlink php && brew link php
as well as ensure you're using the right php binary, ie: /usr/local/bin/php
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-acfddd6be602
2020-05-16 updated
Like @marc-alexander said, this is a bad practice. You should not use --ignore-platform-reqs
option if you do not sure what you are doing.
I thought the option would ignore the platform requirements and install the specific version of the packages. But in fact it will ignore the platform requirements and install the highest available version of the packages.
So if you need the missing PHP extension, you should just install (or enable) it
Reference: ignore-platform-reqs installs dev-master instead of correct version
Original
If you do not need ext-zip
(e.g. You just want to do some quick fix), you can use --ignore-platform-reqs
option to ignore the requirements:
$ composer update --ignore-platform-reqs
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
I had problems with python symlink during the brew install php
.
/usr/local/Frameworks
didn't exist so I had to create it: sudo mkdir /usr/local/Frameworks
cd /usr/local/
Then I had to chown it: sudo chown -R myuser:admin Frameworks
I based the permission settings on the rest of the folders in /usr/local
.
Then I could run brew link python
. Then I ran brew install php
again and it completed.
php -v
now gives me php 7.3.10 , before it was php 7.3.18 I think.
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
In my case I had to simply
brew link --overwrite php
As other users already mentioned: This error usually means, that your PATH variable is not set up correctly, so some MAMP binaries are not found by the terminal.
Shell config
I use the following code in my .zshrc
(or .bashrc
) profile to set the correct PATHs for the current PHP version:
export PHP_VERSION=$(php -r 'echo PHP_VERSION;')
export PATH="/Applications/MAMP/Library/bin/:$PATH"
export PATH="/Applications/MAMP/bin/php/php$PHP_VERSION/bin/:$PATH"
Details
export PHP_VERSION=$(php -r 'echo PHP_VERSION;') this line fetches the PHP version from the current PHP interpreter. After that, you can access $PHP_VERSION in any shell script.
export PATH="/Applications/MAMP/Library/bin/:$PATH" this is a standard path that I need for MAMP integrations to work
export PATH="/Applications/MAMP/bin/php/php$PHP_VERSION/bin/:$PATH" this is the important part, which adds the correct phpX.Y.Z folder to the path list. This line uses the $PHP_VERSION which we fetched in the first line above.
Check
After adding the above snippet to .zshrc
(or .bashrc
) you need to load the updated shell profile by running the following command
source ~/.zshrc # or ~/.bashrc
Finally, you can do a quick check so see if the PATH values are correct:
echo -e ${PATH//:/\\n}
# Output:
...
/Applications/MAMP/bin/php/php7.4.12/bin/ ← this line contains the PHP version
/Applications/MAMP/Library/bin/
...
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.
The solutions above did not work for MacOS Big Sur. However, I cam to working solution:
Download latest tarbal at https://pecl.php.net/package/zip brew install pcre2 fix a symlink, but check the version of your php (which php) and pcre2 (which pcre2) in order to install zip-1.20.1 in step 4. ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /opt/homebrew/opt/php@7.3/include/php/ext/pcre/pcre2.h sudo pear install ~/Downloads/zip-1.20.1.tgz
Result: Installing /opt/homebrew/Cellar/php@7.3/7.3.33_2/pecl/20180731/zip.so
install ok: channel://pecl.php.net/zip-1.20.1 Extension zip enabled in php.ini
Restart apache: sudo apachectl restart Make sure that the location of php used by apache and the one used in your terminal is the same (MacOS homebrew!). Therefore, execute which php in the terminal and open a php file with the following command in your browser: exec('which php'). Make sure that in the httpd.conf file php path links the right php version!
Success story sharing
export PATH="/usr/local/opt/php@7.3/bin:$PATH"
export PATH="/usr/local/opt/php@7.3/sbin:$PATH"
to my .zshrcThen reload your console.
is very important I missed to close and open the terminal and struggled for hours.