Including Zend


(As) #1

Hi,

i try to use the Zend XmlRPC Client so i did put the Libs in a folder called "Zend" in the vendors folder in my core yii installation. Then i used the following code as i found it many times on the web:


Yii::import('application.vendors.*');

require_once 'Zend/XmlRpc/Client.php';

Still yii replys:


require_once(/Zend/XmlRpc/Client.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory

Any idea what i could have done wrong?


(As) #2

Okay, i did add an include path to the php.ini file


; UNIX: "/path1:/path2"  

include_path = ".:/Applications/MAMP/bin/php5/lib/php:/Users/as/Sites/yii/framework/vendors/"

And now the Client.php is included by yii but it gives the following Error:


include(Zend_Uri_Http.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

But that file does exist exactly where it should.

Anyone any experience with this?

Any good ideas?


(As) #3

Though i haven’t figured it out yet, it seems to be related to the autoloader.

require works but the Zend autoloader doesn’t.


#0 /Users/as/Sites/yii/framework/YiiBase.php(338): autoload()

#1 unknown(0): autoload()

#2 unknown(0): spl_autoload_call()

#3 /Users/as/Sites/yii/framework/vendors/Zend/Uri.php(125): class_exists()

#4 /Users/as/Sites/yii/framework/vendors/Zend/Http/Client.php(268): factory()

#5 /Users/as/Sites/yii/framework/vendors/Zend/XmlRpc/Client.php(266): Zend_Http_Client->setUri()

[...]

in Zend/Uri.php the Line 125 to 128 go:


if (!class_exists($className))

    require_once 'Zend/Loader.php';

    Zend_Loader::loadClass($className);

}



Also the Zend Loader uses “include” instead of “require” though i can’t see where that should be the problem.

include should use the include path set in the php.ini as well right?

Anyone any ideas?


(Basvanvelzen) #4

Hi,

Not sure if any help, but for the PHPExcel classes I used something like this:




spl_autoload_unregister(array('YiiBase','autoload'));

require_once('PHPExcel/IOFactory.php');

...doing stuff with PHPExcel...

spl_autoload_register(array('YiiBase','autoload'));



That way it could register the autoload from PHPExcel…

Bas