Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I'm trying to initialize the S3 client from the AWS PHP SDK. My code is as follows:

$credentials = new Credentials(self::KEY, self::SECRET);

$s3_client = new S3Client([

    'version'     => 'latest',

    'region'      => $region,

    'credentials' => $credentials

]);

But am getting the following errors:

A PHP Error was encountered

Severity: 4096

Message: Argument 1 passed to Aws\Common\Client\AbstractClient::__construct() must implement interface Aws\Common\Credentials\CredentialsInterface, array given, called in /opt/showhouse/www/application/models/showhouse/common/services/aws/aws.php on line 47 and defined Filename: Client/AbstractClient.php

Line Number: 73

Any ideas where I am going wrong? Am using the latest version of the SDK installed via Composer.

1 Answer

0 votes
by (44.4k points)

The parameters for your AbstractClient class are:

__construct( Aws\Common\Aws\CommonCredentials\CredentialsInterface $credentials, Aws\Common\Aws\Common\Signature\SignatureInterface $signature, Guzzle\Common\Collection $config )

What you are using is for PHP v 3.0 but it will work in 2.0

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...