I've re-written this question to make it clearer, since I've updated it.
I'm having trouble with the Amazon AWS S3 PHP SDK. I'm just trying to check if a file exists. Using this PHP script:
<?php
require_once("../../../configs/config.".get_current_user().".php");
require INCLUDES_PATH . 'libraries/aws/aws-autoloader.php';
use Aws\S3\S3Client;
$client = S3Client::factory(array(
'key' => AWS_ACCESS_KEY_ID,
'secret' => AWS_SECRET_KEY
));
$key = 'profile/avatar/80745d03-c295-4205-bd82-58161f2fd2d1-320.jpg';
$result = $client->doesObjectExist( AWS_S3_BUCKET, $key );
var_dump(AWS_S3_BUCKET);
var_dump($key);
var_dump($result);
?>
This is the output:
string(19) "stage.socialite.app"
string(59) "profile/avatar/80745d03-c295-4205-bd82-58161f2fd2d1-320.jpg"
bool(false)
I know the file exists, it's here:
This is the IAM policy for the user, whose Key ID and Secret Key I'm using:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::stage.socialite.app/*",
"arn:aws:s3:::stage.socialite.app"
]
}
]
}
I've just created a new Key/Secret pair and added them to my config - what have I done wrong?