PHP
Composer

composer updateに失敗する原因

症状

[root@xxxxxxx]# composer diagnose
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking disk free space: OK
Composer version: 1.6.5
PHP version: 7.2.8
PHP binary path: /usr/bin/php

composer updateに失敗したのでcomposer diagnoseしてみるとこんな感じに。
rootでcomposer使うな!って警告出てるけどdockerコンテナ内なんで無視する。
エラーメッセージによるとSSL処理に失敗したらしいがブラウザから直接GitHubへの接続には問題ない。
意味がワカラン。。

原因

Kasperskyが邪魔してた模様。
機能を一時停止したら以下の状態へ。

[root@xxxxxx]# composer diagnose
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Composer version: 1.6.5
PHP version: 7.2.8
PHP binary path: /usr/bin/php

これならイケる!

対処

Kasperskyの機能を一時停止して更新できた。