4
votes

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

2
did you try to restart apache after the install ?Emad Ha
I installed PHP with XAMPP and used /opt/lampp/xampp restart but doesn't works the installation of LaravelLilian
second step is to check if the extension is really installed php -m you can as well grep php -m | grep zipEmad Ha
On uncommenting both lines, you've enabled both the Windows and the Unix extension... have you checked through the given lines that you've edited the proper files?Nico Haase
third step would be cheking if composer is using the actual php version, for that you can try php composer.phar, where composer.phar is its path, i had it one time using a different php version, so it could be a reason as wellEmad Ha

2 Answers

3
votes
  • 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
1
votes

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.