Sei*_* E. 2 php timezone amazon-s3 amazon-web-services laravel
I receive this error from AWS:
App\Services\Exceptions\Exception thrown with message "Error in updated facebook event in the systemError executing "PutObject" on "n.jpg"; AWS HTTP error: Client error: PUT n.jpg resulted in a 403 Forbidden response:
RequestTimeTooSkewed
The difference between the reque (truncated...) RequestTimeTooSkewed (client): The difference between the request time and the current time is too large. -RequestTimeTooSkewed
The difference between the request time and the current time is too large.20180403T075710Z2018-04-03T06:57:48Z900000"
It says request time is: 7:57 am
and server time is: 6:57 am
.
However my local machine time is: 9:57 am
(not using vagrant or any server).
and my AWS is in Ohio where the time is: 2:57 am
.
What do I change to fix this error ?
我正在建立一个php/Laravel 5.5
项目。
您需要更新 AWS 服务器和本地机器上的时间。最好的方法是运行ntpdate
命令来同步时间。
命令:
sudo ntpdate -u in.pool.ntp.org
Run Code Online (Sandbox Code Playgroud)
它说请求时间是:上午 7:57,服务器时间是:上午 6:57。
服务器时间是指 AWS 服务器 (S3) 的时间。
我的 AWS 位于俄亥俄州,时间为:凌晨 2:57。
这没关系。AWS 在协调世界时 (UTC) 上运行。各个地区的服务器不知道时间是什么,在哪里。
请求时间是指编码到请求中的时间戳,在代码运行的任何地方生成 - 在本例中可能是您的台式机/笔记本电脑。它以 UTC 编码。
然而我的本地机器时间是:上午 9:57(不使用 vagrant 或任何服务器)。
一般来说,计算机——操作系统——有两个概念相互作用来回答“现在几点了?”的问题。--
这两者都需要正确......否则,您的时钟可能会同时:
您的计算机认为其时钟设置为显示 UTC+2 时区的正确本地时间...因此,在签署请求时,它会从显示的“本地”时间中减去 2 小时(显示 9:57,请求时间7:57)...但是如果上午 9:57 是您的当地时间,那么您计算机上的时区设置不正确,因为您实际上处于 UTC+3,因为“服务器”(在亚马逊)有时间显示为 6:57。
更正您的时区设置,然后将时钟调整一小时(如有必要)应该可以解决该问题。