tpyo / amazon-s3-php-class

A standalone Amazon S3 (REST) client for PHP 5/CURL
1.03k stars 504 forks source link

AuthorizationHeaderMalformed: the region 'us-east-1' is wrong; expecting 'ap-northeast-1' #165

Open CuteDeng opened 4 years ago

CuteDeng commented 4 years ago

get PHP Warning when S3::PutObject(), " AuthorizationHeaderMalformed: the region 'us-east-1' is wrong; expecting 'ap-northeast-1'"

maharzan commented 4 years ago

me too getting the same error but if you create the right bucket it works.

phpandrew commented 4 years ago

Have you tried using setRegion->('ap-northeast-1') ?

indextwo commented 4 years ago

@lylesback2's answer is almost exactly right (just a small typo) but it totally pointed me in the right direction and now my uploads are working as expected.

$awsRegion = 'us-east-2';
$s3 = new S3($awsID, $awsSK);
$s3->setRegion($awsRegion);