将 php SDK 与 DynamoDB 结合使用会提供“STS_Exception”,但与 S3 配合使用效果很好


Using php SDK with DynamoDB gives "STS_Exception", but works fine with S3

服务器设置:

CentOS 6.2 64位Ngingx 1.2.1PHP 5.3 + PHP FPM

我通过PEAR将SDK作为软件包安装。我设置了config.inc.php。我正在将 sdk 包含在require_once 'AWSSDKforPHP/sdk.class.php';

我还设置了我的 DynamoDB,并有一个包含一些示例项的表。

如果我执行类似$dynamodb = new AmazonDynamoDB();的操作,则会在浏览器中收到以下错误:

Fatal error: Uncaught exception 'STS_Exception' with message 'Temporary credentials from the AWS Security Token Service could not be retrieved using the provided long term credentials. It's possible that the provided long term credentials were invalid.' in /usr/share/pear/AWSSDKforPHP/sdk.class.php:763 Stack trace: #0 [internal function]: CFRuntime->cache_sts_credentials(Object(CacheFile), Array) #1 /usr/share/pear/AWSSDKforPHP/lib/cachecore/cachecore.class.php(136): call_user_func_array(Array, Array) #2 /usr/share/pear/AWSSDKforPHP/services/dynamodb.class.php(287): CacheCore->response_manager(Array, Array) #3 /var/www/picobama.com/public/canvas.php(14): AmazonDynamoDB->__construct(Array) #4 {main} thrown in /usr/share/pear/AWSSDKforPHP/sdk.class.php on line 763

但是,如果我启动 S3 或 EC2 类,则没有错误。

我什至创建了一个新的密钥/秘密组合以在我的config.inc中使用.php认为默认组合可能有问题,但没有奏效。

我是SDK的新手,我不知道还能尝试什么,我将非常感谢任何帮助。

显然,

我的服务器时间和亚马逊服务器的时间之间存在差异,这导致了身份验证错误。

通过安装/配置 NTP(网络时间协议)轻松修复。

有关 CentOS 的说明,请参阅下面的网址:
http://www.cyberciti.biz/faq/howto-install-ntp-to-synchronize-server-clock/

相关文章: