7

I'm trying to install Magento 2.1 via the composer meta-package with the following command

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition

However, composer fails to update the packages.json from repo.magento.com, and reports

The "https://repo.magento.com/packages.json" file could not be downloaded: Failed to enable crypto

Does anyone know what triggers this "Failed to enable crypto" error is and how someone could fix it?

  • while retrieving data repo.magento.com it need authentication you should have auth.json in your root directory that will contain magento repository username and password { "http-basic": { "repo.magento.com": { "username": "a98186c7f7777dbb05d959bdb91b9729", "password": "344ce14c479f1c8eae77edb58b4ec66f" } } } – Aman Alam Jun 23 '16 at 21:47
  • @amanAlam Are you sure? Because I've had an auth.json for a while and its worked fine until today. Also, the error is referencing a crypto problem, not an authentication problem. What makes you sure it's an auth error? – Alan Storm Jun 23 '16 at 21:50
  • Not very much sure because, previously i have some authentication error while installing and it resolved issue so i thought it may help you. – Aman Alam Jun 23 '16 at 21:53
  • Check this link this may help you github.com/composer/composer/issues/4825 – Aman Alam Jun 23 '16 at 21:56
  • @AlanStorm in your code example, the --repository-url isn't spelled correctly. I couldn't make the edit myself, as SE wants a minimum of 6 characters in an edit, and I didn't want to mess with your question. – ryanF Jun 24 '16 at 0:08
6

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)

4

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!

  • 2
    Updating the OS X liip package worked for me. Without knowing more, if you're still seeing the crypto error my guess would be you're not executing the latest liip version. – Alan Storm Jul 18 '16 at 16:56
  • OMG that was FAST! :D Yep you were right, I wasn't using the latest version. I sat an alias for php5.6 in my bash_profile and it worked! Thank you again Alan! – mrzhero Jul 18 '16 at 17:03
-1

I'm not sure what would cause that error, other than something possibly related to Composer establishing a secured connection over https? But that's just a guess.

I just ran the command right now and it was successful.

Maybe try it again? My apologies for not providing more insight.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.