I am getting an error using s3tools within a script. I may me missing something really obvious here, but I'm hoping someone can point that out to me.

The command in the script is: s3cmd sync --recursive local-folder/ s3://mybucket/s3-folder/

The goal is to sync the contents of folder "local-folder" to the contents of "s3-folder" in bucket "mybucket", copying only what has changed.

When I run this manually (entering the command above in a login shell) it works fine (I add --verbose and get no errors at all).

When I run this in a script, it gives a return code of 127 and returns what appears to be a listing (ls- l) of "local-folder"

The script I run is in PHP 5.5 using "exec("s3cmd sync --recursive local-folder/ s3://mybucket/s3-folder/",$return,$output);" but I have also tried this in a bash script and it returns the same error.

I am running this on Ubuntu 14.04

I would very much appreciate any advice or direction on how I can get this to function successfully within the script.

Thank you!