installa ext-zip per Mac


55

Sto cercando di eseguire composer updatee ottengo i seguenti errori:

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].

durante la corsa composer update

Durante la notte ho commesso l'errore della mia vita e ho permesso al mio Mac di aggiornare automaticamente il sistema operativo, quindi ora mi trovo in macOS Catalina.

Ho provato ad aggiungere

 "require": {
    "ext-zip": "*",
 }

al mio compositore.json..ma non scarica quell'estensione.


1
Questo errore significa solo che il tuo PHP non ha l' php-zipestensione installata.
Latheesan,

Avendo lo stesso problema, phpinfo dice che è installato ... molto strano ... grazie Apple ...
Jamie Robinson

@JamieRobinson fammi sapere se hai trovato una soluzione per favore!
Abdul

@Abdul migliore che abbia fatto finora sta usando "compositore install --ignore-platform-reqs" ... non è una soluzione ma aggira il problema a breve termine
Jamie Robinson

@JamieRobinson per tua informazione, qualcuno ha risposto con qualcosa che ha funzionato per me.
Abdul

Risposte:


129

Ho avuto lo stesso problema dopo aver aggiornato il mio Mac a Catalina. Ecco cosa ha funzionato per me.

brew update
brew install php@7.3
brew link php@7.3

Quindi ricaricare la console.

Installerà php 7.3.10 con il modulo zip. È possibile utilizzare php -v per verificare la versione e php -m per i moduli.


Grazie mille! che ha funzionato come un fascino!
Abdul

2
@Aldranor sembra quasi che funzioni, eseguire un'installazione di birra sembra un buon piano. Tuttavia, ora viene visualizzato "Errore: impossibile collegare simbolicamente sbin / php-fpm" "/ usr / local / sbin non è scrivibile." ... la birra non funziona sudo ... nessuna idea?
Jamie Robinson,

8
Finalmente risolto! L'esecuzione di "brew doctor" dice che questa cartella non esiste e non è scrivibile e ti dà i comandi per l'esecuzione. Esegui quei comandi, esegui di nuovo il comando link, ricarica la console, tutto alla normalità :)
Jamie Robinson,

8
usa 'brew link --force php@7.3' se vedi questo avviso "php@7.3 è solo keg e deve essere collegato con --force"
leeCoder

3
export PATH="/usr/local/opt/php@7.3/bin:$PATH" export PATH="/usr/local/opt/php@7.3/sbin:$PATH"Funzionava , ma solo dopo aver aggiunto: al mio .zshrc
Loosie94 il

14

Il comando seguente ha risolto il problema su macOS Catalina

brew link php@7.3 --force

6

Se brew link non funziona per te, controlla la tua versione php installata da:

ls /usr/local/opt/php*

Qui vedrai una versione come tale:

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

Dovresti darti un risultato come:

/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

Ora devi solo collegarlo al tuo $ PATH che può essere fatto come:

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

Nota: sto usando .zshrc perché questa è la mia configurazione del terminale. Se il tuo è bash, usa di conseguenza.

Puoi verificare quale versione di php è ora collegata a MacOS eseguendo:

which php

Questo dovrebbe darti un output di:

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

Questo è tutto. Ora se provi l'aggiornamento del compositore, non dovrebbe darti il ​​problema dell'estensione.

Fonte (parte di esso): https://medium.com/@jjdanek/installing-php-extensions-on-mac-after-homebrew-acfddd6be602


6

Il 10 marzo 2020, Funziona per me:

brew install php  

È l'unico comando su PHP che funziona. Quindi, penso che i comandi mostrati negli ultimi post siano obsoleti.


1
Confermato il 24 marzo 2020
Frank Leal

26 marzo 2020 confermato.
Muhammad Ali,

Conformità del 7 aprile
PSN

14 aprile 2021. Confermato dal futuro.
Pandem1c,

4

Ho avuto problemi con Python Symlink durante il brew install php.

/usr/local/Frameworks non esisteva quindi ho dovuto crearlo: sudo mkdir /usr/local/Frameworks

cd /usr/local/

Quindi ho dovuto chown: sudo chown -R myuser:admin Frameworks

Ho basato le impostazioni di autorizzazione sul resto delle cartelle in /usr/local.

Allora potrei correre brew link python. Poi ho corso di brew install phpnuovo e ha completato.

php -v ora mi dà php 7.3.10, prima che fosse php 7.3.18 penso.


Proporrei di usare ---> sudo chown -R $ (whoami) bin etc include lib sbin share var Frameworks <---- invece di ---> sudo chown -R myuser: admin Frameworks <---
Ben Spi,

2

Invece di forzare il collegamento, puoi anche risolvere il problema in MacOS Catalina

aggiungendo il percorso binario php al tuo profilo bash, ad esempio:

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

2

Se non è necessario ext-zip(ad esempio, si desidera semplicemente eseguire una soluzione rapida), è possibile utilizzare l' --ignore-platform-reqsopzione per ignorare i requisiti:

$ composer update --ignore-platform-reqs

1

Questo ha funzionato per me

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

Spero che sia d'aiuto


Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.