0

I installed AWS SDK along with Facebook and Google SDKs. All of them are working with no problem on my local MacOs environment. But once I pushed to our server all AWS clients are not working. FB and Google still working on production.

include_once(__DIR__ . "/../../../vendor/autoload.php");
use Aws\Rekognition\RekognitionClient;
use Aws\Sdk;
class RekognitionTest extends CI_Controller
{
private $client;

function __construct()
{
    $sharedConfig = [
        'version' => 'latest',
        'region' => 'us-east-1',
        'credentials' => [
            'key' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            'secret' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        ]
    ];
    $sdk = new Sdk($sharedConfig);
    $this->client = $sdk->createRekognition();
 }
}

in the above code I am getting error:

PHP Fatal error: Class 'Aws\Sdk' not found

Also tried different ways to initiate the client using:

$this->client = new RekognitionClient([
            'version' => 'latest',
            'region' => 'us-east-1',
            'credentials' => [
                'key' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                'secret' => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            ]
        ]);

With the second way I am getting :

PHP Fatal error: Class 'Aws\Rekognition\RekognitionClient' not found

SDK version: "aws/aws-sdk-php": "^3.82"

I am not sure what I am doing wrong here.

Zeedia
  • 1,313
  • 14
  • 20
  • 2
    Have you run `composer install` command? –  Jan 10 '19 at 00:16
  • I ran it on my local when I installed the sdk but not on the server. I just pushed the code via git – Zeedia Jan 10 '19 at 00:25
  • It's likely that you ignore your `vendor` folder from committing to your git repo. Try to run `composer install` on your AWS server. –  Jan 10 '19 at 00:29
  • No, vendor is not ignored. because FB and Google sdks are installed via composer on my local and they working with no issue – Zeedia Jan 10 '19 at 00:33

1 Answers1

0

based on AWS SDK PHP Class Not Found. I deleted SDK downloaded via composer and installed it again from .zip https://github.com/aws/aws-sdk-php/releases and that worked perfectly. I am not sure why composer files are different from zip file.

Zeedia
  • 1,313
  • 14
  • 20