S3 PHP putObject失败并显示403,可能是错误的文件名

时间:2018-08-27 23:16:38

标签: php amazon-s3

我正在尝试通过PHP脚本上传一些文件。该脚本可以很好地上传所有内容,但突然卡在该特定文件上:

'/modules/chopinmol/input/CM_010217_164106_5892640295573/__MACOSX/Max-distelsa2017/._32LH570B_televisor(1).jpg'

给我以下错误:

array (size=3)
  'code' => int 403
  'headers' => 
    array (size=8)
      'HTTP/1.1 403 Forbidden' => string '' (length=0)
      'x-amz-request-id' => string 'ABE18DCEB2FE0522' (length=16)
      'x-amz-id-2' => string 'pMj/coQxdCMhVmQ0pA33qWhkPNs2K58xf/aeF3mP5/Ro/tS2yU94WoqC+0QHf930fUpbsafmd3A=' (length=76)
      'Content-Type' => string 'application/xml' (length=15)
      'Transfer-Encoding' => string 'chunked' (length=7)
      'Date' => string 'Mon, 27 Aug 2018 23' (length=19)
      'Connection' => string 'close' (length=5)
      'Server' => string 'AmazonS3' (length=8)
  'body' => string '<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>xxx</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256
20180827T230632Z
20180827/us-west-2/s3/aws4_request
299b3cf4620df5a94fdca4c2fc06e53bf93b6e5743433f0293247d24285bb40a</StringToSign><SignatureProvided>5a7557a5521a7591075302e52686254ebf5e82cb4be3ba72187bb741b4dcf7d7</'... (length=3650)
/var/www/html/chopinmol/modules/awscloudfronts3/classes/aws/AWSConnection.php:51:string 'PUT
/modules/chopinmol/input/CM_010217_164106_5892640295573/__MACOSX/Max-distelsa2017/._32LH570B_televisor(1).jpg

accept:*/*
cache-control:max-age=31536000, public
content-length:222
content-type:application/octet-stream
expect:100-continue
host:95278282c3887844a69b1f29e4cbcce5.s3-us-west-2.amazonaws.com
x-amz-acl:public-read
x-amz-content-sha256:a51b33110b0975da3524fa5dd82ef06d02d42353726075926046cbb95f466b5a
x-amz-date:20180827T230632Z

accept;cache-control;content-length;content-type;expect;host;x-amz-a'... (length=611)

在其他先前文件中,请求成功执行没有问题。所以我的直觉告诉我它一定是文件名。

有人可以帮助我发现问题吗?

如果有帮助,这是请求:

URL:

'https://95278282c3887844a69b1f29e4cbcce5.s3-us-west-2.amazonaws.com/modules/chopinmol/input/CM_010217_164106_5892640295573/__MACOSX/Max-distelsa2017/._32LH570B_televisor(1).jpg'

标题:

array (size=10)
  'host' => string '95278282c3887844a69b1f29e4cbcce5.s3-us-west-2.amazonaws.com' (length=59)
  'x-amz-date' => string '20180827T231403Z' (length=16)
  'Accept' => string '*/*' (length=3)
  'x-amz-acl' => string 'public-read' (length=11)
  'Content-Type' => string 'application/octet-stream' (length=24)
  'Cache-Control' => string 'max-age=31536000, public' (length=24)
  'Expect' => string '100-continue' (length=12)
  'Content-Length' => int 222
  'x-amz-content-sha256' => string 'a51b33110b0975da3524fa5dd82ef06d02d42353726075926046cbb95f466b5a' (length=64)
  'Authorization' => string 'AWS4-HMAC-SHA256 Credential=xxx/20180827/us-west-2/s3/aws4_request,SignedHeaders=accept;cache-control;content-length;content-type;expect;host;x-amz-acl;x-amz-content-sha256;x-amz-date,Signature=xxx' (length=275)

0 个答案:

没有答案