2015-08-17 2 views
1

Я использую AWS PHP SDK V2.8 в своем cakephp. Я работаю над машиной AWS ec2 ubuntu.Класс 'Aws Common Aws' не найден cakephp

Я использую zip-файлы, а не любой композитор.

Я получаю следующее сообщение об ошибке.

Class 'Aws\Common\Aws' not found 

Я создаю пользовательский компонент для доступа ко всем функциям SDK. со ссылкой на https://github.com/Ali1/cakephp-amazon-aws-sdk

структуры Моя папка выглядит следующим образом

enter image description here

Вот мой AmazonComponent.php

<?php 

App::uses('Component', 'Controller'); 
use Aws\Common\Aws; 

/** 
* AmazonComponent 
* 
* Provides an entry point into the Amazon SDK. 
*/ 
class AmazonComponent extends Component { 

    /** 
    * Constructor 
    * saves the controller reference for later use 
    * @param ComponentCollection $collection A ComponentCollection this component can use to lazy load its components 
    * @param array $settings Array of configuration settings. 
    */ 
    public function __construct(ComponentCollection $collection, $settings = array()) { 
    $this->_controller = $collection->getController(); 
    parent::__construct($collection, $settings); 
    } 

    /** 
    * Initialization method. Triggered before the controller's `beforeFilfer` 
    * method but after the model instantiation. 
    * 
    * @param Controller $controller 
    * @param array $settings 
    * @return null 
    * @access public 
    */ 
    public function initialize(Controller $controller) { 
    // Handle loading our library firstly... 
     $this->Aws = Aws::factory(Configure::read('Amazonsdk.credentials')); 
    } 

    /** 
    * PHP magic method for satisfying requests for undefined variables. We 
    * will attempt to determine the service that the user is requesting and 
    * start it up for them. 
    * 
    * @var string $variable 
    * @return mixed 
    * @access public 
    */ 
    public function __get($variable) { 
    $this->$variable = $this->Aws->get($variable); 
    return $this->$variable; 
    } 
} 

добавить эти две линии на вершине в файле со ссылкой этого вопроса How to load AWS SDK into CakePHP?

ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'). PATH_SEPARATOR . ROOT .DS . 'app/Plugin/Amazonsdk/Vendor/aws'); 

require ROOT . DS . 'app/Plugin/Amazonsdk/Vendor/aws/aws-autoloader.php'; 

Где я ошибаюсь и как я могу это исправить?

ответ

0

@urfusion могли бы вы PLS переместить папку AWS SDK от app/Plugin к app/Vendor Сиде в приложение/Vendor А потом попробуйте импортировать AWS-AmazonComponent SDK, имеющий функцию initialize.

Я использую AWS PHP SDK V3

// Ручка загрузки нашей библиотеки, во-первых ...

App::import('Vendor','aws-autoloader',array('file'=>'aws'.DS.'aws-autoloader.php')); 
Смежные вопросы