Magento 2: What Causes the "Failed to enable crypto" Error?
It sounds like Magento's severely tightened up their HTTPS on the repo.magento.com
server.
These settings are tight enough that applications that support HTTPS but use an older version of OpenSSL may have their connections rejected.
Meaning, if the version of PHP you're using to run composer.phar
is linked against and older version of PHP, you'll get the Failed to enable crypto error. You can test your version of PHP with the following code snippet.
error_reporting(E_ALL);
$context = stream_context_create();
$contents = file_get_contents('https://repo.magento.com/packages.json', false, $context);
The reason I got this error was/is the packaged version of PHP I've been using (depending on how you count) for almost 13 years was linking against an older version of SSL. The package maintainers have released a new build that seems to address these problems.
If you're using a different packaged version of PHP, you'll need to pressure the package maintainers to release a new build that fixes this, or pressure Magento to do the same.
If you're building a version of PHP yourself (by hand, via brew
, etc) then make sure you're using as modern a version of OpenSSL with modern TLS support (I may have used those words wrong, not an HTTPS/SSL expert by any stretch)
I resolved by updating the OS X liip package
http://php-osx.liip.ch
you just need to run the one-line command on that page
source: http://devdocs.magento.com/guides/v2.0/release-notes/tech_bull_tls-repo.html
EDIT: After this, check that you're using the updated version with php -v
and which php
Thank you @AlanStorm!