當系統升級到OSX 10.10.3的時候,用brew更新軟件安裝包,出現了curl拋出的錯誤。
==> Upgrading boost
==> Downloading https://homebrew.bintray.com/bottles/boost-1.58.0.yosemite.bottle.tar.gz
0.7%
curl: (56) SSLRead() return error -9806
Error: Failed to download resource "boost"
起初,以爲是寬帶的問題,據說某寬帶在使用過程中老是插入廣告,竟連curl抓取數據包都難免植入廣告。
如果是寬帶的問題,應該說curl獲取一切信息都會出錯,經嘗試,對於http協議的請求都是fine的,那麼嘗試https協議,發現github也是好的,可以收到數據。但是,一旦請求的https的具體的某一個包的時候,出現curl(56)錯誤:
error:curl: (56) SSLRead() return error -9806
查詢得知:curl(56)錯誤是----CURL_RECV_ERROR:Failure with receiving network data.
意思很明確了:curl接收網絡數據失敗。
最後的最後,只能從網上獲取答案:很幸運,有人比我早遇到此類問題:
在stackoverflow上有篇名爲《osx 10.10 Curl POST to HTTPS url gives SSLRead() error》
I just recently upgraded to OSX 10.10 Yosemite and I since the upgrade I can't do Curl POST to a SSL url anymore.
I first used wordpress' wp_remote_request call and also tried to use curl in php.Both (as expected) give the same error message:
Error Number:56Error String:SSLRead() return error -9806
Note: when I curl POST to HTTP it works fine.I reckon it is a setting in PHP.ini or in my apache (I lost my original HTTPD.conf file after upgrade...).
Can anyone help me out?
這是被採取的答案:
I've seen this error happen when php is compiled with a version of cURL that usesApple's Secure Transport under Yosemite and the target of the URL request doesn't support SSLv3 (which was probably disabled due to thePOODLE vulnerability). What is the output of this command?
I suspect you'll see this:
You can overcome this by installing a version of php which uses a version of cURL which uses OpenSSL instead of SecureTransport. This is most easily done withhomebrew. So install that first if
you don't already have it. If homebrew is installed but you haven't run Add the Homebrew taps below that you will need in order to get brewed php installed. Skip this step if these repos are already tapped. If you're unsure if these repos are already tapped, just run the commands below. Worst case scenario, you'll get a harmless
Then install curl with openssl:
Then install php using the curl you just installed and brewed openssl:
Install any php extensions you're going to need eg.
After you're done, run this again:
And you should see:
And now, re-test your application and the 大概意思: 先使用命令 php -i |grep "SSL Version" 看看SSL Version的信息,猜想你看到是:
有可能會出現不傷大雅的警告信息:
安裝你需要的php的其他擴展,例如 :
完成後,再次運行下面的命令:
你會看到:
好吧,這個問題就這樣解決了。 |