lundi 20 avril 2015

AWS SDK PHP aws_autoloader.php not loading paths properly with ZIP method

Im using the Zip method with aws-sdk-php and I get an error with my php app when calling ec2client factory object (or the preceding Use clauses, Im not sure...)

require LIBS_PATH . 'aws-sdk-php/aws-autoloader.php';

use Aws\Common\Aws;
use Aws\Common\Enum\Region;
use Aws\Ec2\Ec2Client;

public function createAWSApp($app_id)
{
    // Get users region
    $this->app->aws_region = $this->getUserAWSRegion();

    // Setup the EC2 object
    $this->ec2client = Ec2Client::factory(array(
        //'profile' => '<profile in your aws credentials file>',
        'key' => AWS_ACCESS_KEY_ID,
        'secret' => AWS_SECRET_ACCESS_KEY,
        'region'  => $this->app->aws_region
    ));

...

The app's framework results in error

The file Aws\Ec2\Ec2Client.php is missing in the libs folder.

If I remove the Use clauses and explicitly name the files such as with a require_once :

require LIBS_PATH . 'aws-sdk-php/aws-autoloader.php';

use Aws\Common\Aws;
use Aws\Common\Enum\Region;
//use Aws\Ec2\Ec2Client;
require_once LIBS_PATH . 'aws-sdk-php/Aws/Ec2/Ec2client.php';

public function cr...

I get a similar message but looks like PHP default cannot find file error:

Warning: require_once(libs/aws-sdk-php/Aws/Ec2/Ec2client.php): failed to open stream: No such file or directory

LIBS_PATH is correct and works for other libraries Im using, the aws-sdk-php files are definitely present etc.

Please help...




Aucun commentaire:

Enregistrer un commentaire