Zip extension and unzip command missing when installing magento in composer

  1. Dedicated Server at Digitalocean
  2. I setup the server myself following your guide : How to install Magento 2.3 and build a web server
  3. Ubuntu 16.04.2 , Apache & PHP 7.2 or 7.4 :thinking:??
  4. Magento 2.3

Hi, i got stucked on you tutorial right in the part when i m about to download magento on composer i get the following message:

  The zip extension and unzip command are both missing, skipping.                   
  Your command-line PHP is using multiple ini files. Run `php --ini` to show them.  

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

after running the php --ini i found out that i have a different php version:

Configuration File (php.ini) Path: /etc/php/7.4/cli
Loaded Configuration File: /etc/php/7.4/cli/php.ini
Scan for additional .ini files in: /etc/php/7.4/cli/conf.d
Additional .ini files parsed: /etc/php/7.4/cli/conf.d/10-mysqlnd.ini,

what should i do is there i way i can fix this? Thanks!


Magento 2 doesn’t support PHP 7.4.

Please refer to Craig’s tutorial How to install Magento 2.3 and build a web server

Refer to the paragraph.

Install PHP and any extensions specifically for Magento 2.3

and run the following command if you want to install php7.2

sudo apt-get install php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-soap php7.2-bcmath php7.2-xml php7.2-mbstring php7.2-gd php7.2-common php7.2-cli php7.2-curl php7.2-intl php7.2-zip zip unzip -y


sudo apt-get install php7.3 libapache2-mod-php7.3 php7.3-mysql php7.3-soap php7.3-bcmath php7.3-xml php7.3-mbstring php7.3-gd php7.3-common php7.3-cli php7.3-curl php7.3-intl php7.2-zip zip unzip -y

if you want to install php 7.3

both contain zip, unzip
Worth to read the following:
Upgrading PHP 7.2.x > 7.3.x

I already did as you suggested and right before installing magento in composer php 7.4 keeps coming back up:

 Problem 1
    - Installation request for magento/product-community-edition 2.3.3 -> satisfiable by magento/product-community-edition[2.3.3].
    - magento/product-community-edition 2.3.3 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.2) does not satisfy that requirement.
  Problem 2
    - Installation request for magento/magento2-functional-testing-framework 2.4.5 -> satisfiable by magento/magento2-functional-testing-framework[2.4.5].
    - magento/magento2-functional-testing-framework 2.4.5 requires php 7.0.2||7.0.4||~7.0.6||~7.1.0||~7.2.0||~7.3.0 -> your PHP version (7.4.2) does not satisfy that requirement.

Is there a way i can uninstall php 7.4 or have php 7.2 rule over 7.4?

So i did the following to switch versions:
i first checked the version y was in with : sudo php -v
then ran this to switch to php 7.2 : sudo rm /etc/alternatives/php; sudo ln -s /usr/bin/php7,2/etc/alternatives/php;
seemed to work cause i repeated the first step and it said i was now working on php 7.2

afterwards y went back again to install magento and got a message that:

Project directory ./ is not empty.  

i went back again to check and delete any files on the cd /var/www/html and left it this way but it still wont work it keeps trowing the project directory is not empty message.

magento@ubuntu-florentino : /var/www/html $ ls -la
total 12
drwxr-xr-x 3 magento www-data 4096 Jan 27 23:55 .
drwxr-xr-x 3 root root 4096 Jan 27 02:57 ..
drwxr-xr-x 7 magento www-data 4096 Jan 27 22:50 update
magento@ubuntu-florentino : /var/www/html $

Thanks for your help and patience

Hi @Andrea_Segura and welcome.

Whenever you execute the composer create command, it starts to create documents required for the creation process. However, when it fails (like the PHP issue above), is abandons everything it was doing in the folder - Which is why you’re left with things like the update folder.

In order to run the composer create command, it won’t run if you the target folder is empty… So, in your situation just delete the update folder by running the following command from the Magento root directory as the “Magento” user:

rm -rf update

You’re then free to rerun the composer create command.

1 Like

Awesome! just finished setting up my magento install! Thanks