Search code examples
phplaraveldebianlaravel-6

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


Solution

    • 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