Amazon S3 Upload error SSL certificate issues

2019-05-24 13:12发布

I'm trying to test Laravel Amazon S3 on my localhost but keep getting the same error:

S3Exception in WrappedHttpHandler.php line 192: Error executing "ListObjects" on "https://s3-us-west-2.amazonaws.com/app?prefix=appimages%2FIMG-1469840859-j.jpg%2F&max-keys=1&encoding-type=url"; 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)

My code :

$s3 = \Storage::disk('s3');
$filePath = '/images/' . $filename;
$s3->put($filePath, file_get_contents($image), 'public');

1条回答
仙女界的扛把子
2楼-- · 2019-05-24 13:22

You have do a tweak to the php.ini file. Download this file http://curl.haxx.se/ca/cacert.pem and set the path in php.ini like this and then restart the server.

;;;;;;;;;;;;;;;;;;;;
; php.ini Options  ;
;;;;;;;;;;;;;;;;;;;;

curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

Above path is common for XAAMP

And that will fix your issue.

查看更多
登录 后发表回答