PHP AWS HTTP错误:无法使用模式r + fopen打开

dKo*_*sec 5 php amazon-s3 amazon-web-services aws-sdk

我一直在将我的PHP服务器文件从windows转移到ubuntu 14.04而我的脚本坏了...从S3下载时我收到错误.

        $result = $s3->getObject(array(
            'Bucket' => AWS_S3_BUCKET,
            'Key'    => $imgName,
            'SaveAs' => $targetPath
        )); //the exception is thrown!
Run Code Online (Sandbox Code Playgroud)

异常消息:

http://s3.amazonaws.com/bucket/file上执行GetObject时出错AWS HTTP错误:无法使用模式r +:fopen(../../ downloads/file)打开../../downloads/file.

sudo chmod -R 777 wwwfolder didn't work

有任何想法吗?

**更新**

找到一个Hax /解决方法....在$ s3-> getObject方法之前添加touch($ targetPath)修复问题......但为什么呢?我尝试了不同的ubuntu服务器(相同的版本),并在那里工作(没有触摸;我不知道它是如何配置...).现在呢?有任何想法吗?