• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Dev Tips / Upgrade Composer – SHA384 is not supported by your openssl extension, could not verify the phar file integrity

Upgrade Composer – SHA384 is not supported by your openssl extension, could not verify the phar file integrity

Last updated on November 1, 2019 by Sal Ferrarello

Ideally, the PHP package manager Composer can update itself with the command

composer self-update

Unfortunately, when I ran this command I got

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

This is a known issue (see Composer Issue 7669) but unfortunately the thread does not offer a clear solution.

How I Upgraded Composer

I’m on a Mac running macOS Mojave (10.14), here is how I worked around this RuntimeException and upgraded my version of Composer.

Find Composer’s Location

To find the location of your current (out-dated) version of Composer, run

type composer

composer is hashed (/usr/local/bin/composer)

Take note of the composer location (in my case /usr/local/bin/composer), this will be important in a moment.

Run the Initial Composer Install

From the command line, run the Composer install command (as documented at Download Composer).

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

This displayed the message

Composer (version 1.9.0) successfully installed to: /Users/sal/composer.phar
Use it: php composer.phar

Make note of the new installation path (in my case /Users/sal/composer.phar), this will also be important in a moment.

Move the New Version to the Correct Location

From the command line you’re going to move (mv) the new installation path (in my case /Users/sal/composer.phar) to the composer location (in my case /usr/local/bin/composer). Here is the command I ran

mv /Users/sal/composer.phar /usr/local/bin/composer

Check the Change Occurred

By running

composer --version

you should now see the latest version of the Composer.

Thanks

This post originally came about during my Five for the Future (5ftf) work at WebDevstudios. Thank you, WebDevStudios.

Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Solution Tagged With: composer

Reader Interactions

Comments

  1. Marc says

    July 14, 2020 at 10:52 am

    Hey Sal, thanks for sharing this!
    Hate it when a simple update doesn’t work 🙂

    Cheers

    Reply
  2. Andy says

    September 29, 2020 at 8:31 am

    Thanks for the post Sal. This worked perfectly!

    Reply
  3. Subhabrata karmakar says

    August 14, 2021 at 10:11 am

    Thank you Sal,
    I am searching this solution for last 30min. I don’t imagine that it is so simple. I just have to move the new composer.phar to the old location.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in