环境 : xampp

php : 7.3

在更新了PHP版本之后显示调用S3的 doesObjectExist 一直显示失败, 然后打开调试模式

try {
    self::$obj = new S3Client([
        // 地区 亚太区域(新加坡) ap-southeast-1
        'region' => self::$config['region'],

        //
        'version' => self::$config['version'],

        // 加载证书
        'credentials' => new Credentials(self::$config['key'], self::$config['secret']),

        // 开启bug调试
        'debug' => true

    ]);
} catch (S3Exception $e) {
    Log::record($e->getMessage());
    die();
}

 

显示报错误为,

cURL错误60:SSL证书问题:无法获取本地颁发者证书(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html ) 

排查了下发现是php.ini里面的 curl.cainfo  没有设置, 

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
; curl.cainfo =

 

修改完, 重启服务, 错误完美解决

参考链接

https://stackoverflow.com/questions/38667165/amazon-s3-upload-error-ssl-certificate-issues

https://www.656463.com/wenda/AmazonS3sccwSSLzswt_391

https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-examples-creating-buckets.html