Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing aws php sdk - unexpected variables

I'm trying to use the AWS php sdk, and having some issues getting set up. I'm getting this error when I run my php script that requires the autoloader:

Parse error: syntax error, unexpected '$value' (T_VARIABLE) in /[directory path]/Aws/functions.php on line 36

I looked in that document, and line 36 is the one that begins with if ($pred($value)).

function filter($iterable, callable $pred){
    foreach ($iterable as $value) {
        if ($pred($value)) {
            yield $value;
        }
    }
}

Not really sure how to work around this, so any tips would be greatly appreciated. Things I've tried: installing with composer. installing with .zip.

Followed these steps: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html

like image 967
bkopp Avatar asked Jun 01 '15 18:06

bkopp


People also ask

How install AWS SDK in PHP?

The AWS SDK for PHP includes a ZIP file containing all the classes and dependencies you need to run the SDK. Additionally, the ZIP file includes a class autoloader for the AWS SDK for PHP and its dependencies. To install the SDK, download the . zip file, and then extract it into your project at a location you choose.

What is AWS PHP SDK?

The SDK is a modern, open-source PHP library that makes it easy to integrate your PHP application with AWS services like Amazon S3, Amazon Glacier, and Amazon DynamoDB.

What is the simplest way to construct client object in AWS?

To make requests to Amazon Web Services, you first create a service client object. The recommended way is to use the service client builder. Each AWS service has a service interface with methods for each action in the service API. For example, the service interface for DynamoDB is named AmazonDynamoDBClient.


1 Answers

The yield keyword for generators requires PHP 5.5.

Support for the last version that didn't have generators ended mid-late 2015. Continuing to use anything below what is currently supported is a bad idea. Consider bumping your PHP version.

Having said that, you may want to investigate sdk version 2.8.8 or lower. The 'required' sections of packagist list the php version requirements.

like image 60
castis Avatar answered Sep 29 '22 16:09

castis