9

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.

Manuel Sayago
  • 113
  • 1
  • 1
  • 5
  • 4
    Install Synaptic package manager from the Software Center. Then you can use that to install specific PHP modules, in particular the Open SSL module. I'd recommend using a virtual machine though, like vagrant. Or better yet, use Laravel's Homestead, which is a virtual machine with everything you need to get off the ground with Laravel. – Jonathon Sep 05 '16 at 20:39
  • These might help: [The openssl extension is required for SSL/TLS protection](http://stackoverflow.com/questions/35249620/the-openssl-extension-is-required-for-ssl-tls-protection), [How to enable PHP's openssl extension to install Composer?](http://stackoverflow.com/q/18064612/934739), [Composer Warning: openssl extension is missing. How to enable in WAMP](http://stackoverflow.com/questions/14062055/composer-warning-openssl-extension-is-missing-how-to-enable-in-wamp). – Gerard Roche Sep 05 '16 at 21:37
  • [Php composer openssl error](http://stackoverflow.com/questions/35756590/php-composer-openssl-error), [How to enable OpenSSL for PHP Cli?](http://askubuntu.com/questions/398950/how-to-enable-openssl-for-php-cli). – Gerard Roche Sep 05 '16 at 21:39

4 Answers4

27
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

delatbabel
  • 3,601
  • 24
  • 29
5

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

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
3

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
Kumanan
  • 420
  • 1
  • 4
  • 11
1

Try this

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer

Related to this issue https://github.com/composer/composer/issues/5510. Hope it also fixes yours