执行“;ListBuckets”;关于“;https://s3-us-west-2.amazonaws.com/:这个错


Error executing "ListBuckets" on "https://s3-us-west-2.amazonaws.com/ : What could be the reason for this error?

当我试图列出buckets时,我得到以下php错误:

( ! ) Fatal error: Uncaught exception 'Aws'S3'Exception'S3Exception' with message 
'Error executing "ListBuckets" on "https://s3-us-west-2.amazonaws.com/";
AWS HTTP error: cURL error 60: SSL certificate problem: unable to get 
local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in 
C:'wamp'www'Web_Projects'aws'Aws'WrappedHttpHandler.php on line 159
( ! ) Aws'S3'Exception'S3Exception: Error executing "ListBuckets" on 
"https://s3-us-west-2.amazonaws.com/"; AWS HTTP error: cURL error 60: SSL 
certificate problem: unable to get local issuer certificate (see 
http://curl.haxx.se/libcurl/c/libcurl-errors.html) in 
C:'wamp'www'Web_Projects'aws'Aws'WrappedHttpHandler.php on line 159
Call Stack

我正在尝试的代码:

<?php
    error_reporting(1);
    require 'aws-autoloader.php';
    use Aws'S3'S3Client;

    $options = [
        'region'            => 'us-west-2',
        'version'           => 'latest',
        'credentials' => [
            'key'    => 'AKXXXXXXLPPHXXXXXXXXXPA',
            'secret' => 'a/b/c+d',
        ]
    ];
    $s3Client = new S3Client($options);
    $s3Client->listBuckets();
?>

我出现上述错误的原因是什么?

这些错误指的是在本地密钥库中定位发布根中间CA的问题

AWS HTTP error: cURL error 60: SSL certificate problem: unable to get 
local issuer certificate

如libcurl错误代码所示,错误60为:

CURLE_SSL_CACERT (60) Peer certificate cannot be authenticated with known CA certificates.

试试这个:使用CURL的命令行版本连接到您所指的HTTPS url:

curl https://www.example.com

您应该看到以下消息:

>curl  https://www.example.com
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

请按照上面和服务器SSL证书详细信息中提供的说明进行操作。还要运行Qualsys SSL服务器测试,以帮助分析任何可能的问题。

通过命令行确认并修复后,重新运行代码。它应该正确运行。