Lilian
Lilian

Reputation: 109

I cannot install Laravel with Composer (ext-zip extension is missing)

I tried to install Laravel with Composer on my Debian 9 terminal with

composer global require laravel/installer

But I get the following errors:

Using version ^3.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/installer v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /opt/lampp/etc/php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

I tried to install the PHP ext Zip extension with:

apt-get install php7.4-zip

and

apt-get install php-zip

and also edit the php.ini file uncommenting the following lines:

extension=php_zip.dll
extension="zip.so"

But nothing works and I have the same errors...

Upvotes: 5

Views: 16837

Answers (2)

Kai Carver
Kai Carver

Reputation: 2298

I had the same problem as you.

I could see that I was lacking the zip extension by doing

php -m

I did

apt search php | grep zip

to see if there was a package I could install, I found php-zip, so I did

sudo apt install php-zip

after which php -m showed zip in the list.

Then I tried the command to install Laravel again

composer global require laravel/installer

and it succeeded.

Upvotes: 3

Emad Ha
Emad Ha

Reputation: 1222

  • Make sure to restart the webserver after the change
  • php -m to list the compiled modules
  • it happened to me once (on plesk) that composer was using a different php version than to use php itself
  • You could try php composer.phar(the location of that) and check the results

If Installing laravel is what matters here

here are some possible solutions

  • composer create-project laravel/laravel [dir]
  • or git clone https://github.com/laravel/laravel.git then cd to that directory, usually laravel, so cd laravel then composer install

Upvotes: 3

Related Questions