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
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.