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

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

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

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.

Related

PHP Laravel error - Your requirements could not be resolved to an installable set of packages

I'm trying to create laravel project in WSL2 ubuntu. I have the projects folder (www) in the WSL root directory, inside that folder i have laravel_test subfolder. When i run
composer create-project laravel/laravel example-app
but i'm getting an error
Your requirements could not be resolved to an installable set of packages.
How can i slove this issue?
root#LAPTOP-R27NIA9B:~/www/laravel_test# composer create-project laravel/laravel example-app
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? Y
Creating a "laravel/laravel" project at "./example-app"
Installing laravel/laravel (v9.3.5)
- Installing laravel/laravel (v9.3.5): Extracting archive
Created project in /root/www/laravel_test/example-app
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires laravel/pint ^1.0 -> satisfiable by laravel/pint[v1.0.0, v1.1.0, v1.1.1].
- laravel/pint[v1.0.0, ..., v1.1.1] require ext-xml * -> it is missing from your system. Install or enable PHP's xml extension.
Problem 2
- phpunit/phpunit[9.5.10, ..., 9.5.x-dev] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
- Root composer.json requires phpunit/phpunit ^9.5.10 -> satisfiable by phpunit/phpunit[9.5.10, ..., 9.5.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/8.1/cli/php.ini
- /etc/php/8.1/cli/conf.d/10-opcache.ini
- /etc/php/8.1/cli/conf.d/10-pdo.ini
- /etc/php/8.1/cli/conf.d/20-calendar.ini
- /etc/php/8.1/cli/conf.d/20-ctype.ini
- /etc/php/8.1/cli/conf.d/20-exif.ini
- /etc/php/8.1/cli/conf.d/20-ffi.ini
- /etc/php/8.1/cli/conf.d/20-fileinfo.ini
- /etc/php/8.1/cli/conf.d/20-ftp.ini
- /etc/php/8.1/cli/conf.d/20-gettext.ini
- /etc/php/8.1/cli/conf.d/20-iconv.ini
- /etc/php/8.1/cli/conf.d/20-phar.ini
- /etc/php/8.1/cli/conf.d/20-posix.ini
- /etc/php/8.1/cli/conf.d/20-readline.ini
- /etc/php/8.1/cli/conf.d/20-shmop.ini
- /etc/php/8.1/cli/conf.d/20-sockets.ini
- /etc/php/8.1/cli/conf.d/20-sysvmsg.ini
- /etc/php/8.1/cli/conf.d/20-sysvsem.ini
- /etc/php/8.1/cli/conf.d/20-sysvshm.ini
- /etc/php/8.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-xml --ignore-platform-req=ext-dom` to temporarily ignore these required extensions.
you should just install ext-xml
sudo apt-get install php-xml
laravel/pint needs this package for running correctly
my answer isn't different from Farid Saravi answer , and it solved my problem too
just want to add the answer for the second problem that appeared to me
mentioning that i'm using linux ubuntu 22.04
Problem 1
Root composer.json requires laravel/pint ^1.0 -> satisfiable by laravel/pint[v1.0.0, ..., v1.2.0].
- laravel/pint[v1.0.0, ..., v1.2.0] require ext-xml * -> it is missing from your system. Install or enable PHP's xml extension.
and its answer
sudo apt-get install php-xml
Problem 2
spatie/laravel-ignition[1.0.0, ..., 1.6.1] require ext-curl * -> it is missing from your system. Install or enable PHP's curl extension.
- Root composer.json requires spatie/laravel-ignition ^1.0 -> satisfiable by spatie/laravel-ignition[1.0.0, ..., 1.6.1].
and its answer
sudo apt-get install php-curl
First, delete the project that gave error when creating. Then
Run sudo apt-get install php8.2-curl
you can change php.8.2-curl according to the PHP version you use.
After this, create a project again. It will be successfully created

What does this error mean on my Terminal when I try to command composer global require "laravel/installer"?

I'm trying to install Laravel using composer command, which I already successfully installed.
Then, when I input $ composer global require "laravel/installer", I get the error message below that I don't understand.
Details:
MacBook Pro(Version: 10.15.3)
using Xampp
Thank you!
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].
Installation failed, deleting ./composer.json.
It says that it requires zip extension
brew update
brew install php#7.3
brew link php#7.3
It will install PHP 7.3.10 with the zip module. You can use PHP -v to check for the version, and PHP -m for the modules to check.
With respect to your errors Please do the following.
Add below to your ~/.bash_profile file:
export PATH="/usr/local/opt/php#7.3/bin:$PATH"
export PATH="/usr/local/opt/php#7.3/sbin:$PATH"
OR try adding the following in ~/.bashrc file
export PATH="/usr/local/opt/php#7.3/bin:$PATH"
export PATH="/usr/local/opt/php#7.3/sbin:$PATH"
This issue is already mentioned in the Laravel github repository here
As mentioned in the article. You can resolve this using below commands
brew install php#7.3
brew link php#7.3 --force
echo 'export PATH="/usr/local/opt/php#7.3/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="/usr/local/opt/php#7.3/sbin:$PATH"' >> ~/.bashrc

Can't install laravel installer via composer on MAC (catalina)

I am being asked to install PHP extension. I've used brew install php#7.3 it updated but has not satisfied the requirements. What do i need to do to satisfy the requirements?
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/installer ^2.2 -> satisfiable by laravel/installer[v2.2.0].
- laravel/installer v2.2.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
I've tried the suggestions in this post and it did not work for me.
I found this solution here.
"I solved this problem by first creating a new dir sbin in the local dir:
sudo mkdir sbin
then if you are like me using macOS highSierra 10+ you need to run:
sudo chown -R $(whoami) $(brew --prefix)
after this
brew link php
"

To enable extensions, verify that they are enabled in those .ini files - Ubuntu

error in install package baibaratsky/php-webmoney in Ubuntu server 14.0.4 in ssh with this code:
composer require baibaratsky/php-webmoney
root#euv:/var/www/my# composer require baibaratsky/php-webmoney
Key kartik-v/yii2-widget-fileinput is a duplicate in ./composer.json at line 25
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^0.15.1 for baibaratsky/php-webmoney
./composer.json has been updated
Key kartik-v/yii2-widget-fileinput is a duplicate in ./composer.json at line 25
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
- linslin/yii2-curl 1.0.8 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- linslin/yii2-curl 1.0.8 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- linslin/yii2-curl 1.0.8 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- Installation request for linslin/yii2-curl (locked at 1.0.8, required as *) -> satisfiable by linslin/yii2-curl[1.0.8].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php5/cli/php.ini
- /etc/php5/cli/conf.d/05-opcache.ini
- /etc/php5/cli/conf.d/10-pdo.ini
- /etc/php5/cli/conf.d/20-gd.ini
- /etc/php5/cli/conf.d/20-intl.ini
- /etc/php5/cli/conf.d/20-json.ini
- /etc/php5/cli/conf.d/20-mysql.ini
- /etc/php5/cli/conf.d/20-mysqli.ini
- /etc/php5/cli/conf.d/20-pdo_mysql.ini
- /etc/php5/cli/conf.d/20-readline.ini
- /etc/php5/cli/conf.d/20-xsl.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
i installed this package but dont fix error.
sudo apt-get install php5-gd
sudo apt-get install php5-intl
sudo apt-get install php5-xsl
install CURL fix this error
sudo apt-get install php5-curl
You will need to restart the server afterwards:
sudo service apache2 restart
Alternatively, if you are using php-fpm, you'll need to restart php5-fpm instead
sudo service php5-fpm restart

ext-mcrypt error while installing laravel on ubuntu 14.04

I am beginner in laravel in ubuntu 14.04.
I try to run this following commend for install laravel.
composer create-project laravel/laravel --prefer-dist
and i got following error.
i am also try to install ncrypt but i got same error.
Installing laravel/laravel (v5.0.1)
- Installing laravel/laravel (v5.0.1)
Loading from cache
Created project in /opt/lampp/htdocs/laravel
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- laravel/framework v5.0.1 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- laravel/framework v5.0.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[v5.0.0, v5.0.1, v5.0.2].
i am also try to run this command but i got this same error.
sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
Thanks in advance..
I am open this file
gedit /etc/php5/cli/php.ini
put one line in to this file
extension=mcrypt.so
and this run successfully.
any ways thanks again.
This is how I solved on Mac Yosemite. I have one php.ini in /etc/, and I have mcrypt instaIled. But I faced the same problem.
Run this to find another php.ini.
php -i|grep ini
It returned the followings.
System => Darwin Myname-MacBook-Pro.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Configuration File (php.ini) Path => /usr/local/etc/php/5.5
Loaded Configuration File => /usr/local/etc/php/5.5/php.ini
....
I open /usr/local/etc/php/5.5/php.ini and added extension=mcrypt.so to the file.
I hope this will help someone in future.
Mac users with brew just run in CLI:
brew install php56-mcrypt
Doinion Rings.

Categories