简体   繁体   中英

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. 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().

-J

So I added a shutdown function to get the last error since the \\AWS\\SDK call essentially died:

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

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

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). 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.

Anyway, I fetched composer and built on the instance (fedora) and the problem went away.

Since this took so much time the first time I figured I'd pass on the info.

-J

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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