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

匿名 (未验证) 提交于 2019-12-03 01:23:02

问题:

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?

回答1:

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.



回答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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!