120

I get the error when i run composer self-update on Windows 10
Here is the full error message

     composer self-update
     Updating to version 1.8.4 (stable channel).
     Downloading (100%)


     [RuntimeException]
    SHA384 is not supported by your openssl extension, could not verify the phar file integrity

I am running PHP 7.3.2 What could be the problem?

Edwin
  • 1,135
  • 2
  • 16
  • 24
ovicko
  • 2,242
  • 3
  • 21
  • 37
  • 14
    You're using an old version of composer. Try and completely remove it and install the latest version from scratch. [Here's a Github issue](https://github.com/composer/composer/issues/7802) about this error message. – M. Eriksson Mar 04 '19 at 12:17
  • 1
    you need to unistall composer <= 1.7.2 and then install a new version of composer >= 1.7.3 to avoid that update error for all future update type installs – Stephanie Temple Mar 04 '19 at 12:24
  • 1
    @MagnusEriksson reinstalling worked – ovicko Mar 04 '19 at 12:41
  • Or you can first switch back to php 7.2, then run composer selfupdate. If that was successful, you can switch to php 7.3, or 7.4. – vrgblzs Sep 09 '20 at 08:49

6 Answers6

219

Remove Your older versions and install the latest version of Composer,

Remove Your older version: sudo rm -f /usr/local/bin/composer

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

Move the composer.phar file: sudo mv composer.phar /usr/local/bin/composer

vipinlalrv
  • 2,975
  • 1
  • 14
  • 9
30

Manually update the composer:

wget -cO - https://getcomposer.org/composer-stable.phar > /usr/local/bin/composer

Check the installed composer version:

composer --version
7

The error means you are using composer of version 1.7.2or below. You have to uninstall composer and then install a composer version 1.7.3 and above.

ovicko
  • 2,242
  • 3
  • 21
  • 37
2

I've just experienced the same issue on my Windows machine. I'd just downloaded and installed Composer from https://getcomposer.org/download/ and when I tried to run php composer-setup.php it failed with "SHA384 is not supported by your openssl extension".

The solution that worked for me was to perform the command line install (documented on the same site). Visit https://getcomposer.org/download/ to get the latest SHA.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
George
  • 2,860
  • 18
  • 31
maccaroo
  • 819
  • 2
  • 12
  • 22
0

you can download latest version from https://getcomposer.org/ and just replace the file composer.phar in your composer folder, in my machine this is installed in windows at C:\composer

Muhammad Azam
  • 535
  • 7
  • 12
0

Solution 1:

Manually update the composer(Uninstall and install)

Solution 2:

The error means you are using composer version 1.7.2 or below. Uninstall composer and then install a composer version 1.7.3 and above.

or

composer self-update --rollback and run composer self-update.
bfontaine
  • 18,169
  • 13
  • 73
  • 107
Nithin Ninan
  • 111
  • 1