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日

悬赏问题

  • ¥15 请问下这个红框里面是什么文档或者记事本编辑器
  • ¥15 机器学习教材中的例题询问
  • ¥15 求.net core 几款免费的pdf编辑器
  • ¥15 为什么安装HCL 和virtualbox之后没有找到VirtualBoxHost-OnlyNetWork?
  • ¥15 C# P/Invoke的效率问题
  • ¥20 thinkphp适配人大金仓问题
  • ¥20 Oracle替换.dbf文件后无法连接,如何解决?(相关搜索:数据库|死循环)
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179