RapidSSL证书的PHP卷曲错误:无法获得本地颁发者证书

时间:2016-10-10 09:42:06

标签: php ssl curl

我已经用我的cPanel共享托管购买了RapidSSL证书,现在当我尝试用curl打开与google.com的连接时,例如,我收到了以下错误:

SSL certificate problem: unable to get local issuer certificate

我正在使用以下代码进行测试:

<?php
$conn = curl_init();

$settings = array(
    CURLOPT_URL => 'https://www.google.com',
    CURLOPT_CONNECTTIMEOUT_MS => 2000,
    CURLOPT_TIMEOUT_MS => 2000,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_SSL_VERIFYPEER => true,
    CURLOPT_CAINFO => '/home/username/ssl/certs/cacert.pem'
);

curl_setopt_array($conn, $settings);

if ($rawResponse = curl_exec($conn)) {
    $info = curl_getinfo($conn);
    var_dump($info);
} else {
    echo curl_error($conn);
}
?>

我尝试过添加SSL .crt文件,但我仍面临同样的问题。有什么想法吗?

0 个答案:

没有答案