Austin DeVinney
Austin DeVinney

Reputation: 273

aws-php-sdk -- Installing without a package manager

I'm working on pulling in the AWS PHP SDK and am running into some issues since my current stack isn't using a package manager. It's not an option to start using it, either (company related -- would rather not elaborate).

That all being said, I'm pulling in the source directly and trying to add it to my include path and just including the files as I need them in my S3 wrapper objects that I'm writing. However, it's running into issues with the namespaces (I think) and those blowing up.

This is the library I'm referring to: https://github.com/aws/aws-sdk-php

I tried following the bit at the bottom about working with AmazonS3 and uploading a file to it. So, I attempted to include the various parts of the code it referenced as follows:

Attempt One

require_once('/includes/third_party/aws-sdk-php-master/src/Aws/Common/Aws.php');
require_once('/includes/third_party/aws-sdk-php-master/src/Aws/S3/Enum/CannedAcl.php');
require_once('/includes/third_party/aws-sdk-php-master/src/Aws/S3/Exception/S3Exception.php');

Attempt Two

set_include_path(get_include_path() . "/includes/third_party/aws-sdk-php-master/src/");
include('Aws/Common/Aws.php');
include('Aws/S3/Enum/CannedAcl')
include('Aws/S3/Exception/S3Exception.php');   

Both of these produced a similar error:

Fatal error: Class 'Guzzle\Service\Builder\ServiceBuilderLoader' not found in \includes\third_party\aws-sdk-php-master\src\Aws\Common\Aws.php on line 26
PHP Fatal error: Class 'Guzzle\Service\Builder\ServiceBuilderLoader' not found in \includes\third_party\aws-sdk-php-master\src\Aws\Common\Aws.php on line 26

Any advice on how to start debugging this? Would be much appreciated!

Upvotes: 3

Views: 5529

Answers (2)

Mike Brant
Mike Brant

Reputation: 71384

You should stick the the recommend installation procedures. Personally, I would go with the Composer installation or just use the PHAR without Composer.

Then you just need to include the PHAR like:

require '/path/to/aws.phar';

And you will have everything you need.

The problem you have now is likely that you are not taking advantage of the autoloader. Using your approach, you will need to manually include all the classes that would normally be autoloaded.

You also need to download and include another library (Guzzle, not included in the PHAR archive).

Upvotes: 0

Jeremy Lindblom
Jeremy Lindblom

Reputation: 6527

The AWS SDK for PHP nows ships a zip file with everything you need, including an autoloader: http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/installation.html#installing-via-zip.

Upvotes: 8

Related Questions