I get the following error when trying to access my S3 bucket using the AWS PHP SDK:
Uncaught exception 'InvalidArgumentException' with message 'File not found: /Applications/MAMP/htdocs/vendor/aws/aws-sdk-php/src/Endpoint/../data/endpoints_prefix_history.json'
.
The file endpoints_prefix_history.json
does not exist. I installed the SDK using composer, and I'm trying the basic usage examples - https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/getting-started_basic-usage.html.
I'm currently using the following code to connect to my AWS account:
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
try{
$s3_client = new Aws\S3\S3Client([
'region' => 'eu-west-1',
'version' => '2006-03-01',
'credentials' => [
'key' => '<KEY>',
'secret' => '<SECRET>'
]
]);
//Listing all S3 Bucket
$buckets = $s3_client->listBuckets();
foreach ($buckets['Buckets'] as $bucket) {
echo $bucket['Name'] . "
";
}
}catch( S3Exception $e ){
echo $e->getMessage();
}catch(AwsException $e){
echo $e->getAwsRequestId() . "
";
echo $e->getAwsErrorType() . "
";
echo $e->getAwsErrorCode() . "
";
}
constant('Env::ABS_PATH').'vendor/autoload.php';
is being loaded in a config.php
when the app loads.
I'm new to the AWS PHP SDK, so I'm not really sure what is wrong here. Any information in the right direction is highly appreciated.