dth62818 2017-12-20 10:45
浏览 498

在shell脚本中使用aws s3命令并从php调用

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 fesafe材料库问题
    • ¥35 beats蓝牙耳机怎么查看日志
    • ¥15 Fluent齿轮搅油
    • ¥15 八爪鱼爬数据为什么自己停了
    • ¥15 交替优化波束形成和ris反射角使保密速率最大化
    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统