Executing AWS CLI command from php results in Unable to locate credentials

后端 未结 6 1363
太阳男子
太阳男子 2020-12-11 15:56

I am trying to run aws s3 cp command from within php code using shell exec. Following is the php code.

echo shell_exec(\"sudo aws s3 cp s3:///s         


        
6条回答
  •  借酒劲吻你
    2020-12-11 16:31

    Looks like a permission/location issue of the configuration file.

    Credentials set using AWS CLI, is written in a special file in the current user's path. PHP I guess is executing in other permissions (not as the same user). I would suggest you should keep the configs in a separate files and pass to the CLI this way. You also need to ensure that the specific environment variable is available inside PHP shell_exec.

提交回复
热议问题