问题
When I am use the AWS SDK with php I get an error stating that the class cannot be found.
<?php
require_once '/var/www/html/aws.phar';
use Aws\Common\Aws;
use Aws\Common\Enum\Region;
echo "test";
$AWSregion = Region::US_EAST_1;
$aws = Aws\Common\Aws::factory(array('key'=>'key', 'secret' => 'secret_key', 'region' => $AWSregion));
$client = $aws->get('Sqs');
?>
The exact error message I receive is PHP Fatal Error: Class 'Aws\Common\Enum\Region' not found in /var/www/html/sendSQS.php
Any help is appreciated.
Thanks!
回答1:
I had same issue with using sdk in wordpress. I installed sdk via composer,but sdk won't work. Please try zip version,and include sdk by "aws-autoloader.php". https://github.com/aws/aws-sdk-php/releases
回答2:
Looks like you are using AWS SDK V2 code with AWS SDK V3.
Aws\Common\Enum\Region
is obsolete in V3.
来源:https://stackoverflow.com/questions/31654994/aws-sdk-php-class-not-found