views:

449

answers:

1

Hello,

I am trying to set up a PHP path to my Zend Framework. I am very confused on how to do this. My Zend Framework is located at the following location on my server:

amazon/ZendFramework-1.10.3-minimal

I am going to be creating a couple of php files in the amazon/ directory that will require the Zend Framework. My include path is:

include("ZendFramework-1.10.3-minimal/library/Zend/Service/Amazon.php");

However inside of Amazon.php is the line

require_once 'Zend/Rest/Client.php';

...and then Client.php has more dependencies set up like that, and so on.

How can I set up my include path so that Amazon.php and Client.php (and so on) can correctly reference the location of the Zend Framework?

Thanks

+2  A: 

You will have to set your include path using set_include_path() in your boostrap file if you are using any. (need to check the ZF layout for details if you are using the ZF).

The Loading of the classes will be handled by the Zend Loader when you include the library/Zend/Loader.php file and calling the function that will enable the automatic loading of classes that reside in your library/Zend folder.

When you set the include path to your library, include the library/Zend/Loader.php and call Zend_Loader::registerAutoLoad() I believe will be able to work without problems.

short example in a file called bootstrap.php

set_include_path('ZendFramework-1.10.3-minimal/library/'.get_include_path());
require_once('Zend/Loader.php');
Zend_Loader::registerAutoload();
andreas
The above example did the trick, thank you! Small note: remove the accidental semicolon after library/
behrk2
sorry about that...just trying to get it right fast...good to know it helped you.
andreas