9
votes

I'm trying to install composer on Windows but I get the following error:

The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error: 1416F086: SSL routines: tls_process_server_certificate: certificate verify failed Failed to enable crypto failed to open stream: operation failed.

What's going on and how do I fix this?

4
What happens if you try to go to that URL in the web browser on the server? - ceejayoz
This question seems related. But I don't think it's a duplicate. The answers their recommend changing the file_get_contents() call, but OP should not be required to modify the composer installation script to get this done. - HPierce
I have the same error on linode's lamp stack docker container. It's pretty old though, using ubuntu 14.04.1 LTS - con--

4 Answers

2
votes

I have fixed it, the issue you have encountered seems to be related to a missing certificate.

You just need to add your certificate to end of this file:

C:\xampp\apache\bin\curl-ca-bundle.crt

Here's an example how to append the certificate:

-----BEGIN CERTIFICATE-----

MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xvYmFsU2>lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjE... (Your certificate)

-----END CERTIFICATE-----

1
votes

If you are in private network(Restricted Networking) such as Organization, you have to update their certificate in the "curl-ca-bundle.crt", Copy Paste your organization certificate code in the bottom of the "C:\xampp\apache\bin\curl-ca-bundle.crt" file.

0
votes

I had the same issue. You have to find below Certificate and install manually to Trusted root of "Current User/Local Computer".

C:\xampp\apache\bin\curl-ca-bundle.crt
0
votes

As a quick workaround I could run composer through its docker image:

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  composer/composer install

I was bitten by this on my local Ubuntu machine. For no apparent reason, composer would time out.