I am having challenge with aws s3 commands using PHP. Here is the my requirements.
Write a shell script to download few files s3 bucket to local system using aws s3 cp.
Shell Script (1.sh)
#!/bin/bash
aws s3 cp s3://bucket1/1.mp4 /tmp/1.mp4
When I run the above shell script (sh 1.sh or ./1.sh) the file downloaded with out any issues.
Now question is, I want to run the above shell script from PHP. Since the file name passing from from PHP. So, here is my php code.
PHP Script
<?php
$out = exec("sh /var/cronjobs/1.sh 2>&1");
echo $out;
?>
I am getting error like aws command not found. If I give full path of aws then getting a permission issue. I've already given full permission.