3

I'm trying to implement Amazon WebServices PHP SDK into my Zend 1 project, but it seems to fail loading the classes.

I have got the library into library/Eplan/AmazonCloudSearch and after investigation it seems that in order to be able to load the namespace I need to call the registerNamespace method from Zend_Loader_Autoloader::getInstance() so I've got this on the top of the autoloader (I also tried to put it in the bootstrap without luck):

require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace("Aws");

Namespaces of the AWS library are like this: Aws\namespace

The errors I get are like Warning: include_once(Aws/Common/Aws.php): failed to open stream: No such file or directory in /srv/www_nfs_desarrollo/vhosts/desarrollo.techmaker.net/httpdocs/library/Zend/Loader.php on line 134

Autoloader full code: http://pastebin.com/gS9mcntK

I've been the full day struggling my head trying to solve this without luck, any ideas?

2 Answers2

2

In order to use $autoloader->registerNamespace('Aws'), the AWS lib you seek must be on your PHP include path, which probably includes your ./library directory. Instead, you have the AWS lib buried down in ./library/Eplan/AmazonCloudSearch, which almost certainly is not on your PHP include_path.

Try moving the AWS library up two levels, directly into the ./library directory.

David Weinraub
  • 14,144
  • 4
  • 42
  • 64
  • 2
    You can also add the include path into your `application.ini` file with `includePaths.myPath = APPLICATION_PATH "/../wherever/it/may/be"` – Kevin Nagurski May 25 '15 at 11:36
1

You can autoload using your application.ini file using following code.

autoloaderNamespaces[] = "Aws"