When I run the following command
sudo composer update
then I am getting following error.
The "https://packagist.org/packages.json" file could not be
downloaded: SSL operation failed with code 1. OpenSSL Error
messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Failed to enable crypto
failed to open stream: operation failed
Best Answer
I came across this issue on OSX after using Homebrew to upgrade to PHP 7.0.12.
To resolve the problem I downloaded
cacert.pem
using WGET.wget http://curl.haxx.se/ca/cacert.pem
I saved that file to my home directory
/Users/alex/cacert.pem
. Then configured my PHP.ini file to point to that cacert location.To do this; First locate your
php.ini
and run the commandphp --ini
that should produce:The INI file to edit is the one at the Loaded Configuration File location. Open that file in your editor of choice (Vim, etc) and find the setting
openssl.cafile
. This is probably commented out so uncomment it and insert the location of yourcacert.pem
.You should then be able to run
compose install
,composer update
,composer self-update
, etc