By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Beginner Problems Using the AWS SDK for PHP

This Article covers some of the common problems a beginner might run into when using the AWS SDK for the first time.

Edited: 2013-05-09 08:20

The AES SDK for PHP should be somewhat easy to use, once you have figured out the composer stuff. But still, this was some of the errors we encountered when using the AWS S3 for the first time.

PermanentRedirectThe bucket you are attempting to access....

This can happen if you haven't specified a Region in your factory method, otherwhise you may get strange errors from the AWS. I.e.

PermanentRedirectThe bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

You can set your region using the factory method of the SDK. I.e.

$client = S3Client::factory(array(
    'key'    => '',
    'secret' => '',
    'region' => 'eu-west-1',

Note. According to the documentation, the region looks like: us-east-1, us-west-1, us-west-2, eu-west-1, and so on. You should use whatever correspond to your own region.

SignatureDoesNotMatch, Status Code: 403....

You might encounter this problem if your credentials does not match those provided. I.e.

The request signature we calculated does not match the signature you provided. Check your key and signing method.

Make sure you enteed the corect key and secret and try again. The error you are getting might look like the below:

Fatal error: Uncaught Aws\S3\Exception\SignatureDoesNotMatchException: AWS Error Code: SignatureDoesNotMatch, Status Code: 403, AWS Request ID