适用于Laravel的AWS开发工具包给出了PHP致命错误 [英] AWS SDK for Laravel giving PHP fatal error

查看:104
本文介绍了适用于Laravel的AWS开发工具包给出了PHP致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 https://github.com/aws/aws-sdk-php -laravel SDK,并按照readme.md中的说明进行操作.一切安装完毕后,我将我的密钥,机密,区域等放在/app/config/packages/aws/aws-sdk-php-laravel中.

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.

我遇到的错误

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}}

上面引用的文件的第48行只是说:

Line 48 of that file referenced above simply says:

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

我已按照说明安装

我在/app/config/app.php中将提供程序和别名放入:

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

'Aws\Laravel\AwsServiceProvider'

在providers数组中.

in the providers array.

我放入:

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

在别名部分.

然后,我尝试使用相同的用法示例:

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"
                ));

我尝试过的

在这里,我唯一的想法是,在我要使用该SDK的文件中,最上面的是:

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;

我已经添加到了

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

以及两者的组合,但均无效.有任何想法吗?

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

推荐答案

您的问题出在aws/aws-sdk-php中的类Aws\Common\Aws中,该类对于作曲者(自动装带器)不可用.这些步骤通常可以修复Laravel,当发生这种情况并且问题不在源代码上时,当然:

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

这篇关于适用于Laravel的AWS开发工具包给出了PHP致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆