dpqg86714 2014-02-14 17:00
浏览 234
已采纳

适用于Laravel的AWS SDK给出了致命错误

I installed the https://github.com/aws/aws-sdk-php-laravel‎ SDK and followed the instructions in the readme.md. Everything installed, I put in my key, secret, region, etc. in the /app/config/packages/aws/aws-sdk-php-laravel.

The Error I'm Getting

PHP Fatal error:  Class 'Aws\Common\Aws' not found in /Volumes/Data/Users/chris/Sites/ln.com/vendor/aws/aws-sdk-php-laravel/src/Aws/Laravel/AwsServiceProvider.php on line 48
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Aws\\Common\\Aws' not found","file":"\/Volumes\/Data\/Users\/chris\/Sites\/ln.com\/vendor\/aws\/aws-sdk-php-laravel\/src\/Aws\/Laravel\/AwsServiceProvider.php","line":48}}

Line 48 of that file referenced above simply says:

$aws = Aws::factory($config);

I installed per the instructions

I put in my providers and aliases in /app/config/app.php with:

'Aws\Laravel\AwsServiceProvider'

in the providers array.

I put in:

'AWS' => 'Aws\Laravel\AwsFacade'

in the aliases section.

Then, I'm trying to use their same usage example:

    $s3 = AWS::get('s3');
$s3->putObject(array(
    'Bucket'    => 'My Bucket',
    'Key'       => 'My Key',
    'SourceFile'=> Config::get('settings.ProcessListings.image_dir') . $listing->mls_listing_id . "/test.txt"
                ));

What I've Tried

My only thoughts here were that in my file that I'm trying to use the SDK in, at the top I have:

    use Illuminate\Console\Command;
    use Symfony\Component\Console\Input\InputOption;
    use Symfony\Component\Console\Input\InputArgument;

I've added to that:

use Aws\Laravel\AwsFacade;
use Aws\Laravel\AwsServiceProvider;

and combinations of the two but neither work. Any ideas?

  • 写回答

2条回答 默认 最新

  • douyou9923 2014-02-14 17:37
    关注

    Your problem is in a class Aws\Common\Aws from aws/aws-sdk-php which is not available to composer (the autoloader). Those are steps that usually fix Laravel, when things like this happen and the problem is not on your source code, of course:

    cd /your/application/dir
    
    rm bootstrap/compiled.php
    
    rm -rf vendor (or just rename your vendor folder to test)
    
    composer update --no-dev
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 专家修改了标签 8月18日

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮