为什么在存储桶 s3 的文件中尝试使用 file_get_contents() 时得到 "acces denied"?
why do i get "acces denied" when trying to use file_get_contents() in a file in a bucket s3?
我正在尝试使用 php 函数在 s3 存储桶中读取和写入文件,我尝试上传一些文件并且它工作正常,但是在尝试此代码时:
ini_set('display_errors', 1);
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
// Instantiate an S3 client
$client = S3Client::factory(array(
'key' => 'key',
'secret' => 'secret-key',
'region' => 'region'
));
$client->registerStreamWrapper();
$data = file_get_contents("s3://bucket_name/file.txt");
echo $data;
我收到这个错误:
AccessDenied Access Denied
请问有什么想法。
谢谢
此错误意味着 php 没有读取此文件的权限,例如您可以将文件权限更改为 0777。
我正在尝试使用 php 函数在 s3 存储桶中读取和写入文件,我尝试上传一些文件并且它工作正常,但是在尝试此代码时:
ini_set('display_errors', 1);
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
// Instantiate an S3 client
$client = S3Client::factory(array(
'key' => 'key',
'secret' => 'secret-key',
'region' => 'region'
));
$client->registerStreamWrapper();
$data = file_get_contents("s3://bucket_name/file.txt");
echo $data;
我收到这个错误:
AccessDenied Access Denied
请问有什么想法。 谢谢
此错误意味着 php 没有读取此文件的权限,例如您可以将文件权限更改为 0777。