【发布时间】:2015-11-24 17:02:35
【问题描述】:
我正在使用getObjectInfo($bucket, $fileUri) 来获取我在 S3 上拥有的文件的详细信息。
相同的代码在 EC2 实例上运行,我收到以下响应:
object(stdClass)#10 (4) {
["error"]=>
bool(false)
["body"]=>
NULL
["headers"]=>
array(5) {
["date"]=>
int(1447937934)
["time"]=>
int(1447835426)
["hash"]=>
string(32) "9841b46a11dfe58z86196cfr812i81sv"
["type"]=>
string(24) "application/octet-stream"
["size"]=>
int(5415)
}
["code"]=>
int(200)
}
但是当我在本地机器上尝试相同的代码时,我得到了以下响应:
object(stdClass)#10 (4) {
["error"]=>
bool(false)
["body"]=>
NULL
["headers"]=>
array(2) {
["type"]=>
string(15) "application/xml"
["date"]=>
int(1447935810)
}
["code"]=>
int(403)
}
还有这个警告:
PHP Warning: S3::getObjectInfo(bucket01,folder1/2015_01_01/abcdefgh/abcdefgh.txt): [403] Unexpected HTTP status in /abc/def/S3.php on line 355
我在下面的链接中使用 amazon S3 PHP 类进行 REST:http://undesigned.org.za/2007/10/22/amazon-s3-php-class
我觉得 S3 存储桶策略存在问题,但不确定是什么问题。 任何建议都会很有帮助。
【问题讨论】:
标签: php amazon-web-services amazon-s3 amazon-ec2