Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot install php composer in Ubuntu 16.04

I have this error when I try to install composer:

Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:

The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with --with-openssl

I followed this steps from my terminal in the Downloads directory:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Just like the website says. What can I do now? I'm using Laravel but I need composer first. I have seen on internet that it's something to do with extensions but I don't know how to it.

Hope someone cal help me with this!

Thanks in advance.

like image 360
Manuel Sayago Avatar asked Sep 05 '16 20:09

Manuel Sayago


3 Answers

sudo apt-get install composer

... worked for me, and will additionally install all of the dependencies. Or, as @Jonathon mentions above, use the synaptic package manager to install composer. Note that this will get you the latest stable composer, not the devel version that you get from doing it on the command line from getcomposer.org

like image 72
delatbabel Avatar answered Oct 07 '22 02:10

delatbabel


Install PHP Composer on Linux machine.

To run below command to Update your packages:

sudo apt-get update

To run below command to Install the curl utility:

sudo apt-get install curl

To run below command to Download the installer:

sudo curl -s https://getcomposer.org/installer | php

To run below command to Move the composer.phar file:

sudo mv composer.phar /usr/local/bin/composer

Test composer installed

composer

Reference Link

like image 5
Gufran Hasan Avatar answered Oct 07 '22 01:10

Gufran Hasan


I have installed composer by running few commands for my Ubuntu 16.04 - laravel PHP application server.

Setup in home directory :

cd ~

Install Curl to get the composer library:

sudo apt-get install curl

Installing composer:

sudo curl -s https://getcomposer.org/installer | php

Move the composer file to bin path :

sudo mv composer.phar /usr/local/bin/composer

Verify composer installation :

composer
like image 3
Kumanan Avatar answered Oct 07 '22 00:10

Kumanan