Q:

Amazon S3 enable versioning

I'm using AWS for PHP in my application to communicate with amazon S3.  I want to enable versioning so I don't overwrite objects with the same keys.  I can't find out how to actually enable the feature...
S3 documentation:

The following request enables versioning on the bucket, bucketName. 

PUT /?versioning HTTP/1.1
Host: bucketName.s3.amazonaws.com
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: AWS AKIAIOSFODNN7EXAMPLE:xQE0diMbLRepdf3YB+FIEXAMPLE=
Content-Type: text/plain
Content-Length: 124

<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Status>Enabled</Status>
</VersioningConfiguration>

I'm not sure where or how to execute that in php and there's no option in the S3 management console to enable versioning.  Does anyone know how? 

A:

You can use the enable_versioning method of the PHP API like this:
$s3 = new AmazonS3();
$s3->enable_versioning($bucket);

There's also a disable_versioning method to disable versioning.