title: Executing AWS CLI command from php results in Unable to locate credentials
body: <p>I am trying to run aws s3 cp command from within php code using shell exec. Following is the php code.</p>
  
  <pre><code>echo shell_exec("sudo aws s3 cp s3://&lt;bucket&gt;/somefolder/somefile s3://&lt;bucket&gt;/someotherfolder/somefile --region ap-southeast-1 --acl public-read");
  </code></pre>
  
  <p>The file is not getting copied and The output from echo is the following</p>
  
  <p>"Unable to locate credentials Completed 1 part(s) with ... file(s) remaining"</p>
  
  <p><strong>Note1: I have already set the credentials using aws configure command</strong></p>
  
  <p><strong>Note2: If I run the exact same command directly from terminal, it works fine.</strong> </p>
  
  <p>Any idea?</p>