An unlikely place to look for an Amazon S3 issue

This has driven me nuts for a few hours so I have to share just in case someone else has similar issue.

Basically I have a PHP script to access Amazon S3 using its SDK for PHP lib, and it runs from a server that I recently built (CentOS). The problem is, the script won’t work. Not that it threw out an error, it just wouldn’t return the result. For example if I was trying to get a list of files with same prefix, it returned an empty array. And it worked every where else and I knew for sure the stuff it’s looking for is there.

I looked everywhere and couldn’t figure out why. Until finally, I noticed that the system time is off by a few hours. It was a whole new story to fix that and this article should explain all you need to know. But in the end, after the system time is corrected, the script works again.

So if you have a script which consumes a web service, make sure the host’s system time is set correctly. It might save you a few hours of a Sunday afternoon.

This entry was posted in PHP development. Bookmark the permalink.

One Response to An unlikely place to look for an Amazon S3 issue

  1. S3 Browser says:

    You can also modify your script to parse s3 error response to handle RequestTimeTooSkewed error code and adjust system time automatically.

Comments are closed.