简体   繁体   English

初始化后,AWS PHP SDK v3发生致命错误-无法打开manifest.json.php

[英]AWS PHP SDK v3 fatal error after initialization - failed opening manifest.json.php

I had a problem with the AWS PHP SDK recently that took a while to figure out so I'll post the solution here. 我最近在AWS PHP SDK上遇到了一个问题,花了一段时间才弄清楚,所以我将解决方案发布在这里。 Hopefully it save someone some time. 希望它可以节省一些时间。

I pushed my code and found that this code would result in fatal error: 我推送了我的代码,发现该代码将导致致命错误:

public static function fetchAWS() {
        $sharedConfig = [ 
                'region' => 'us-east-1',
                'version' => 'latest',
                'credentials' => [ 
                        'key' => self::AWS_APPKEY,
                        'secret' => self::AWS_APPSEC 
                ] 
        ];


    return new \Aws\Sdk ( $sharedConfig );
}
$aws = Class::fetchAWS ();
$ses = $aws->createSes ();

This code passed fetchAWS() but resulted in a fatal exception with no error when calling createSes(). 这段代码通过了fetchAWS(),但是在调用createSes()时导致致命错误,没有错误。

-J -J

So I added a shutdown function to get the last error since the \\AWS\\SDK call essentially died: 因此,我添加了一个关闭函数来获取最后一个错误,因为\\ AWS \\ SDK调用实际上已死:

register_shutdown_function(function ()
        {
            if ($e = error_get_last()) {
                error_log('LAST ERROR---->'. $e['message'] . " in " . $e['file'] . ' line ' . $e['line']);
            }
        });

I use ZF2 so this link was helpful: http://webconsults.eu/blog/entry/78-Error_Handling_for_Debugging_in_Zend_Framework_2 我使用ZF2,因此此链接很有帮助: http ://webconsults.eu/blog/entry/78-Error_Handling_for_Debugging_in_Zend_Framework_2

What I got back was this error: 我得到的是这个错误:

[client 10.180.199.98:54888] LAST ERROR---->include(): Failed opening '/var/www/dev-php/vendor/aws/aws-sdk-php/src/data/manifest.json.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/dev-php/vendor/aws/aws-sdk-php/src/functions.php line 144
  • failed opening manifest.json.php 打开manifest.json.php失败

I had a working server so I compared the folders and found found the SDK wasn't properly transferred (eg the src/data directory was missing on the problem server). 我有一台正在运行的服务器,所以我比较了文件夹,发现SDK没有正确传输(例如,问题服务器上缺少src / data目录)。 I've had to do this since some low end elastic beanstalk instances fail to compose so it's easier to push the vendor folder. 我必须这样做,因为某些低端弹性beantalk实例无法编写,因此更容易推送vendor文件夹。

Anyway, I fetched composer and built on the instance (fedora) and the problem went away. 无论如何,我拿到了作曲家,并在实例(fedora)上进行了构建,问题消失了。

Since this took so much time the first time I figured I'd pass on the info. 由于这是我第一次发现要传递的信息,因此花费了很多时间。

-J -J

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM