I've been plowing through this course from Udamy and enjoying it loads but I'm also aware that the AWS SDK for PHP has recently been updated. I cloned the files from GitHub but they failed, and failed silently.
After checking the errors with the judicious use of:
<?php // Find out what the issues are: ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); // Rest of the code
I discovered that a version is now required and that a TimeZone is also wanted so I altered the code to include these requirements.
<?php // Find out what the issues are: ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); // Date now needs to be set, which I guess is a good thing! date_default_timezone_set('Europe/London'); require '/var/www/html/vendor/autoload.php'; use Aws\DynamoDb\DynamoDbClient; $client = DynamoDbClient::factory(array( 'region' => 'eu-west-1', // replace with your desired region 'version' => '2012-08-10' // Now needs a version )); // Rest of the code
However the waitUntilTableExists
method was still causing issues so after a little research I changed it.
// Rest of the code foreach($tableNames as $tableName) { echo "Waiting for table $tableName to be created." . PHP_EOL; $client->waitUntil('TableExists', array('TableName' => $tableName)); // Changed from v2 echo "Table $tableName has been created." . PHP_EOL; } ?>
The script for loading data also required the version and TimeZone so I altered that as well. Adapted source available on GitHub and Pull Request submitted.
No comments:
Post a Comment