2011-05-13 20 views
2

我正在爲Facebook開發一個開放式ID應用程序。PHP Uncaught CurlException

我收到此錯誤:

Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed thrown in C:\wamp\www\x\modules\openid\facebook.php on line 614

周圍有這樣的代碼:

if (isset($opts[CURLOPT_HTTPHEADER])) { 
    $existing_headers = $opts[CURLOPT_HTTPHEADER]; 
    $existing_headers[] = 'Expect:'; 
    $opts[CURLOPT_HTTPHEADER] = $existing_headers; 
} else { 
    $opts[CURLOPT_HTTPHEADER] = array('Expect:'); 
} 

curl_setopt_array($ch, $opts); 
$result = curl_exec($ch); 
if ($result === false) { 
    $e = new FacebookApiException(array(
    'error_code' => curl_errno($ch), 
    'error'  => array(
     'message' => curl_error($ch), 
     'type' => 'CurlException', 
    ), 
)); 
    curl_close($ch); 
    throw $e; 
} 
curl_close($ch); 
return $result; 
} 

實際行614:

$e = new FacebookApiException(array(

我是運行Windows 7和WAMP與PHP 5.2.11

回答

0

無論出於何種原因,希望您驗證SSL證書。您可以捲曲繼續工作:(從curl

CURLOPT_SSL_VERIFYHOST FALSE

to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2). TRUE by default as of cURL 7.10. Default bundle installed as of cURL 7.10.

您可能還需要檢查成還有CURLOPT_SSL_VERIFYHOST設置。

你也應該看看在這個鏈接:http://forum.developers.facebook.net/viewtopic.php?pid=258460

+2

禁用驗證必將使腳本工作,但是從安全角度來看一個可怕的想法。同行驗證是SSL的一部分,這是有原因的。 – 2011-12-30 23:38:53

+3

@AdamKalsey真正的解決方案是將CA證書添加到主機。歡迎您提供一個答案,以確保「安全」抵制我的行爲,而不是簡單地下調行動,留下模糊的評論,這對任何人都沒有幫助。 – 2012-01-02 19:47:32

+1

@BradFJacobs如何將CA證書添加到我的主機? – Marcel 2012-06-19 00:04:12

相關問題