Amazon S3 上传错误 SSL 证书问题
Amazon S3 Upload error SSL certificate issues
我正在尝试在我的本地主机上测试 Laravel Amazon S3,但一直出现相同的错误:
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)
我的代码:
$s3 = \Storage::disk('s3');
$filePath = '/images/' . $filename;
$s3->put($filePath, file_get_contents($image), 'public');
您对 php.ini 文件进行了调整。下载此文件 http://curl.haxx.se/ca/cacert.pem 并像这样在 php.ini 中设置路径,然后重新启动服务器。
;;;;;;;;;;;;;;;;;;;;
; php.ini Options ;
;;;;;;;;;;;;;;;;;;;;
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
以上路径对于 XAAMP 是通用的
这将解决您的问题。
$s3 = new S3Client
([
'version' => 'latest',
'scheme' =>'http',
'region' => $this->config->item('s3_region'),
'credentials' => [
'key' => $this->config->item('s3_access_key'),
'secret' => $this->config->item('s3_secret_key')
],
]);
添加 'scheme' =>'http' 用于开发。
我遇到了同样的问题。
错误原因是您正在本地或未验证的服务器上工作。
只需将以下行添加到“filesystem.php”
'scheme' => 'http' // to disable SSL verification on local development
您的 filesystem.php 应如下所示:
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'scheme' => 'http' // to disable SSL verification on local development
],
当你运行它在你有SSL验证的服务器上时,你需要注释'scheme'行。
尝试一下,您会发现它有效。
享受你的编码!
我正在尝试在我的本地主机上测试 Laravel Amazon S3,但一直出现相同的错误:
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)
我的代码:
$s3 = \Storage::disk('s3');
$filePath = '/images/' . $filename;
$s3->put($filePath, file_get_contents($image), 'public');
您对 php.ini 文件进行了调整。下载此文件 http://curl.haxx.se/ca/cacert.pem 并像这样在 php.ini 中设置路径,然后重新启动服务器。
;;;;;;;;;;;;;;;;;;;;
; php.ini Options ;
;;;;;;;;;;;;;;;;;;;;
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"
以上路径对于 XAAMP 是通用的
这将解决您的问题。
$s3 = new S3Client
([
'version' => 'latest',
'scheme' =>'http',
'region' => $this->config->item('s3_region'),
'credentials' => [
'key' => $this->config->item('s3_access_key'),
'secret' => $this->config->item('s3_secret_key')
],
]);
添加 'scheme' =>'http' 用于开发。
我遇到了同样的问题。 错误原因是您正在本地或未验证的服务器上工作。 只需将以下行添加到“filesystem.php”
'scheme' => 'http' // to disable SSL verification on local development
您的 filesystem.php 应如下所示:
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'scheme' => 'http' // to disable SSL verification on local development
],
当你运行它在你有SSL验证的服务器上时,你需要注释'scheme'行。
尝试一下,您会发现它有效。 享受你的编码!