Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在兼容S3存储上获取无效的\u签名\u V4\u授权\u头_Php_Laravel_Amazon S3 - Fatal编程技术网

Php 在兼容S3存储上获取无效的\u签名\u V4\u授权\u头

Php 在兼容S3存储上获取无效的\u签名\u V4\u授权\u头,php,laravel,amazon-s3,Php,Laravel,Amazon S3,我无法将我的laravel应用程序与S3兼容的存储器连接。它由IONOS()主持。因为我需要一个不同的基本URL,所以我安装了这个包,它允许我对此进行配置。我在filesystem.php中有这样的配置(默认值在env函数中设置,使用默认值): 但我可以做我想做的。我总是收到以下错误消息: Aws\S3\Exception\S3Exception Error executing "PutObject" on "https://s3-de-central.profitbricks.com/BUC

我无法将我的laravel应用程序与S3兼容的存储器连接。它由IONOS()主持。因为我需要一个不同的基本URL,所以我安装了这个包,它允许我对此进行配置。我在filesystem.php中有这样的配置(默认值在env函数中设置,使用默认值):

但我可以做我想做的。我总是收到以下错误消息:

Aws\S3\Exception\S3Exception

Error executing "PutObject" on "https://s3-de-central.profitbricks.com/BUCKET/32/"; 
    AWS HTTP error: Client error: `PUT https://s3-de-central.profitbricks.com/BUCKET/32/` 
    resulted in a `400 Bad Request` response: 
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>Invalid_Signature_V4_Authorization_Header</Code>
  <Message>Null/Empty S (truncated...) Invalid_Signature_V4_Authorization_Header (client): Null/Empty SigningKey/IsoDate/Signature -     

<?xml version="1.0" encoding="UTF-8"?>
    <Error>
      <Code>Invalid_Signature_V4_Authorization_Header</Code>
      <Message>Null/Empty SigningKey/IsoDate/Signature</Message>
      <RequestId>e7bd3a56-7882-1fc1-b68e-0cc47af2c498</RequestId>
      <HostId>FVqRz72LCRTiUvVKH-VpiEXa5EX3643IbdE6Tyu0-FE</HostId>
    </Error>
不幸的是,我在网上找不到任何关于无效\u签名\u V4\u授权\u头错误的提示。 有了访问数据,我可以通过S3浏览器成功访问bucket。
我还感到惊讶的是,虽然use_path_style_endpoint设置为false,但请求仍然与objects.dreamhost.com/bucket而不是bucket.objects.dreamhost.com冲突。

我最终解决了这个问题。我使用了league/flysystem-aws-s3-v3包(如Laravel所建议的)。通过以下配置(.env文件),它最终起到了作用:

S3_ACCESS_KEY_ID=[ACCESS_KEY]
S3_SECRET_ACCESS_KEY=[SECRET]
S3_DEFAULT_REGION=s3-de-central
S3_BUCKET=[BUCKET_NAME]
S3_URL=https://s3-de-central.profitbricks.com
AWS_URL=https://s3-de-central.profitbricks.com
S3_ACCESS_KEY_ID=[ACCESS_KEY]
S3_SECRET_ACCESS_KEY=[SECRET]
S3_DEFAULT_REGION=s3-de-central
S3_BUCKET=[BUCKET_NAME]
S3_URL=https://s3-de-central.profitbricks.com
AWS_URL=https://s3-de-central.profitbricks.com