Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

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

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
[ComposerDownloaderTransportException] 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
[ComposerDownloaderTransportException] 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: 


  [ComposerDownloaderTransportException]                                     
  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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...