title: Unable to locate credentials aws cli
body: <p>I am using AWS CLI version 2. I am using centos &gt; Nginx &gt; php 7.1, Following command works fine when I directly run on command line.</p>
  <pre><code>aws s3 cp files/abc.pdf s3://bucketname/
  </code></pre>
  <p>but when I run same command from index.php file using following code</p>
  <pre><code>echo exec(&quot;aws s3 cp files/abc.pdf s3://bucketname/ 2&gt;&amp;1&quot;);
  </code></pre>
  <p>then it gives error</p>
  <blockquote>
  <p>upload failed: Unable to locate credentials</p>
  </blockquote>