yiiext / zend-autoloader-component

Fast autoloader for Zend Framework classes.
http://www.yiiframework.com/extension/zendautoloader
5 stars 1 forks source link

Wrong path #1

Closed cebe closed 12 years ago

cebe commented 12 years ago

comment by zang on yiiframework http://www.yiiframework.com/extension/zendautoloader/#c6081

When I want to use this extension, I got an error:

include_once(Zend/Uri/Http.php): failed to open stream: No such file or directory

My code:

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$docs = new Zend_Gdata_Docs($client);
$feed = $docs->getDocumentListFeed();
$this->render('index', array('feed', $feed));

My log:

2011/12/10 21:19:13 [error] [php] include_once(Zend/Uri/Http.php): failed to open stream: No such file or directory (/var/www/modultest.dev/protected/vendors/Zend/Loader.php:146)
Stack trace:
#0 /var/www/modultest.dev/protected/vendors/Zend/Uri.php(137): loadClass()
#1 /var/www/modultest.dev/protected/vendors/Zend/Http/Client.php(305): factory()
#2 /var/www/modultest.dev/protected/vendors/Zend/Gdata/ClientLogin.php(106): Zend_Gdata_HttpClient->setUri()
#3 /var/www/modultest.dev/protected/modules/ZendTest/controllers/DefaultController.php(8): getHttpClient()
#4 /var/www/modultest.dev/framework/web/actions/CInlineAction.php(50): DefaultController->actionIndex()
#5 /var/www/modultest.dev/framework/web/CController.php(300): CInlineAction->runWithParams()
#6 /var/www/modultest.dev/framework/web/CController.php(278): DefaultController->runAction()
#7 /var/www/modultest.dev/framework/web/CController.php(257): DefaultController->runActionWithFilters()
#8 /var/www/modultest.dev/framework/web/CWebApplication.php(277): DefaultController->run()
#9 /var/www/modultest.dev/framework/web/CWebApplication.php(136): CWebApplication->runController()
#10 /var/www/modultest.dev/framework/base/CApplication.php(158): CWebApplication->processRequest()
#11 /var/www/modultest.dev/index.php(22): CWebApplication->run()

Can anyone help me?

cebe commented 12 years ago

Comments from yiiframework:

CeBe @ shark: is your Zend library under protected/vendors/Zend and is Uri/Http.php under there? Make sure you put all files in the right directories.

shark @CeBe: Yes, they are.

cebe commented 12 years ago

So how do you initialize Zend autoloader? Post your code please.

shark300 commented 12 years ago
// change the following paths if necessary
$yii=dirname(__FILE__).'/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

require_once($yii);
$app = Yii::createWebApplication($config);

Yii::import("ext.zendAutoloader.EZendAutoloader", true);

// you can load not only Zend classes but also other classes with the same naming
// convention
EZendAutoloader::$prefixes = array('Zend');

Yii::registerAutoloader(array("EZendAutoloader", "loadClass"));

$app->run();
samdark commented 12 years ago

In order to use this loader one should remove all require_once from Zend files.

cebe commented 12 years ago

Alternatively you could add Yii::import('application.vendors.*'); to add that path to php include path and require_once('Zend/foo/bar.php') can find the files.

shark300 commented 12 years ago
Yii::import('application.vendors.*');

works for me, but slowly. :(

samdark commented 12 years ago

Well, you can do as stated in readme: strip all require_once and then try w/o import.

shark300 commented 12 years ago

I removed all instances of require_once yet.

sajidunnar commented 12 years ago

I had same error , I was calling xmlrpc class of zend and it was stuck on this error .. if you could help so i could gather that data bcos due to that I need to use zend framework for web services consumption

cebe commented 12 years ago

Hm... guess this problem has been sovled, so what exactly is your problem?