OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Failed to enable crypto
Asked Answered
T

4

2

I am using OS X Yosemite

I ran the following command in Composer because Laravel fails to download and install properly all the time:

composer diagnose

result:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" 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 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
Checking composer version: 


  [Composer\Downloader\TransportException]                                     
  The "https://getcomposer.org/version" file could not be downloaded: SSL ope  
  ration 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 

The main line I want to focus on is:

SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto

How can I fix this. I have tried several solutions on the web and none have worked. I am totally new to the use of the command line.

When downloading and installing Laravel with the following command: composer create-project laravel/laravel --prefer-dist can't I just manually download the stuff myself and place it in the correct folder to avoid this SSL problem?

Tupiguarani answered 14/8, 2015 at 22:40 Comment(3)
Not duplicate, but related question providing a solution for cUrl setting the right options. Maybe you just need to fix the configuration.Denizen
I am using OS X so the above Windows solution did not work.Tupiguarani
You also get this error when the mailserver uses an expired certificate.Reorder
T
6

Note: I am running OS X Yosemite. I believe this works with Mavericks too.

After looking a several answers and combining them mixing and matching etc. Here is a rough explanation on what I did.

  1. Open the command line and run:

locate cacert.pem

This will list all the locations where your certificates are.

My result:

/Applications/Adobe Dreamweaver CS6/Configuration/Certs/cacert.pem
/Applications/MAMP/Library/lib/python2.7/test/pycacert.pem
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/cacert.pem
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/pycacert.pem
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_asyncio/pycacert.pem
/Users/robert/.composer/cacert.pem
/opt/vagrant/embedded/cacert.pem
/usr/ssl/certs/cacert.pem
  1. I downloaded the most recent one from curl

http://curl.haxx.se/docs/caextract.html

  1. I made a directory in /usr/ssl/certs/

and put the downloaded cert there /usr/ssl/certs/cacert.pem

  1. I opened up my php.ini file and placed this line at the top of the file: openssl.cafile=/usr/ssl/certs/cacert.pem

  2. Restart apache (stop apache and start it again)

Everything worked out for me.

Now one thing that I do believe needs to be done is you need to tell the command line which PHP you are referring to. I am running PHP under XAMPP and not natively on my OS X. So the command line will think that you are referring to the native PHP on OS X and not the one running on XAMPP. This needs to be changed I believe for this to work. If not then it should be good.

As mentioned this solution worked for me.

Tupiguarani answered 15/8, 2015 at 4:36 Comment(2)
Awesome, this fixed a problem I had with downloading composer. Unfortunately I still get this error when making a call with file_get_contents to the Google Maps API.Cosmetic
Works fine for me too.Nitrobacteria
B
2

I faced this issue while executing composer install in Magento 2 , on MAMP , Mac m1 the issue was fixed after I replaced the file in path : /Applications/MAMP/Library/OpenSSL/cert.pem with the pem file downloaded from the : http://curl.haxx.se/docs/caextract.html

hope this helps someone on .

Bore answered 28/10, 2021 at 7:50 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Albumen
C
0

The easiest way without the need to change the php.ini file:

DEBIAN/UBUNTU:
# apt-get install ca-certificates
FEDORA:
# dnf install ca-certificates.noarch
CENTOS/REDHAT
# yum install ca-certificates.noarch

Source: https://linuxconfig.org/routines-ssl3-get-server-certificate-certificate-verify-failed

Cesarean answered 8/9, 2022 at 21:14 Comment(0)
G
-2

Another possible reason is that the server's SSL cert has expired. If it is your server, check the /etc/apache2/ssl (for ubuntu). The certs usually last for 365 days. See 'https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04' on how to create one.

Ganesha answered 2/9, 2015 at 11:28 Comment(1)
I remember a few minths back in tech news that openssl had been found too not be secure and all certs needed to be updated. I guess mine did not update hence the errorTupiguarani

© 2022 - 2024 — McMap. All rights reserved.