LoginSignup
1
3

More than 3 years have passed since last update.

Composerを更新しようとしたら「SHA384 is not supported by your openssl extension, could not verify the phar file integrity」で失敗する

Posted at

事象

コマンド composer selfupdate を実行してComposerの更新を試みたところ、以下のエラーが発生する

[UserName: laravel]$ composer selfupdate
Updating to version 1.10.5 (stable channel).
   Downloading (100%)


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


self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--set-channel-only] [--] [<version>]

[UserName: laravel]$

原因

利用しているComposerのバージョンが古く、正常に更新が行われない。

【 同一事象の GitHub Issue 】
SHA384 is not supported by your openssl extension, #7802

対応

公式ページ Download Composer の手順に従い、composer.pharをダウンロードする。
以下はバージョン1.10.5の例。

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

公式ページ Installation - Linux / Unix / macOS の手順に従い、インストールする。
以下はグローバルインストールの例。

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

Composerのバージョンを表示させ、正常にインストールされたかを確認する。

[UserName: bin]$ composer --version
Composer version 1.10.5 2020-04-10 11:44:22
[UserName: bin]$
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3