Installation PHP composer on Windows:Step 1: Navigate to the official composer website. Step 2: Then click on the Download button. Step 3: Then click on the Composer-Setup.exe & download the file. Step 4: Then click on “Install for all users”.
This is caused because you don't have a library php5-curl installed in your system,
On Ubuntu its just simple run the line code below, in your case on Xamp take a look in Xamp documentation
sudo apt-get install php5-curl
For anyone who uses php7.0
sudo apt-get install php7.0-curl
For those who uses php7.1
sudo apt-get install php7.1-curl
For those who use php7.2
sudo apt-get install php7.2-curl
For those who use php7.3
sudo apt-get install php7.3-curl
For those who use php7.4
sudo apt-get install php7.4-curl
For those who use php8.0
sudo apt-get install php8.0-curl
Or simply run below command to install by your version:
sudo apt-get install php-curl
This worked for me: http://ubuntuforums.org/showthread.php?t=1519176
After installing composer using the command curl -sS https://getcomposer.org/installer | php
just run a sudo apt-get update
then reinstall curl with sudo apt-get install php5-curl
. Then composer's installation process should work so you can finally run php composer.phar install
to get the dependencies listed in your composer.json file.
on php7 run for example:
> sudo apt-get install php-curl
> sudo apt-get install php-mbstring
for every missing extension. Then:
> sudo apt-get update
and finally (in the project's root folder):
> composer install
As Danack said in comments, there are 2 php.ini files. I uncommented the line with curl extension in the one in Apache folder, which is php.ini used by the web server.
Composer, on the other hand, uses php for console which is a whole different story. Php.ini file for that program is not the one in Apache folder but it's in the PHP folder and I had to uncomment the line in it too. Then I ran the installation again and it was OK.
I ran into the same issue trying to install Dropbox SDK.
CURL was indeed enabled on my system but this meant by the php.ini in the wamp\bin\apache folder.
I simply had to manually edit the php.ini situated in wamp\bin\php, uncomment the extension=php_curl.dll
line, restart Wamp and it worked perfectly.
Why there are those 2 php.ini and only one is used is still a mystery for me...
Hope it's helpul to someone!
I had this problem after upgrading to PHP5.6. My answer is very similar to Adriano's, except I had to run:
sudo apt-get install php5.6-curl
Notice the "5.6". Installing php5-curl didn't work for me.
According to https://github.com/composer/composer/issues/2119 you could extend your local composer.json
to state that it provides the extension (which it doesn't really do - that's why you shouldn't publicly publish your package, only use it internally).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With