Jump to content

Recommended Posts

Hello all,

 

First, let me say that i know this is a known issue...but even after googling around, am still not able to get past this error. Any help would be REALLY appreciated.  :D

 

What im trying to do is use individual components from zend framework -  in this case, the loader class to autoload all by classes in the lib directory. my  app structure is as follows:

 

Root

  application

  lib

    vendor

      Zend

        Loader(directory with all its components inside)

        Loader.php

  web

    index.php

  bootstrap.php

 

the code in the bootstrap is as follows

 


set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib');

require_once dirname(__FILE__) . '/lib/vendor/Zend/Loader/Autoloader.php';

$autoloader = Zend_Loader_Autoloader::getInstance();

 

when i execute this, i get:

 

Warning: require_once(Zend/Loader.php): failed to open stream: No such file or directory in /home/sydney/Projects/Merchant/lib/vendor/Zend/Loader/Autoloader.php on line 24

Fatal error: require_once(): Failed opening required 'Zend/Loader.php' (include_path='.:/usr/share/php:/home/sydney/Projects/Merchant/lib') in /home/sydney/Projects/Merchant/lib/vendor/Zend/Loader/Autoloader.php on line 24

 

 

I'm using debian lenny.

 

I know this must be a configuration issue but i just cant get my head around it. Any help is appreciated. Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/203124-zend-autoload-problem/
Share on other sites

Hello el-sid,

 

I think the problem may be with this line:

 

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib');

 

the Zend Framework is one more directory below where it usually is in your setup.

 

I would be inclined to add that sub folder to the include path like this:

 

set_include_path( dirname(__FILE__)  . '/lib/vendor'  . PATH_SEPARATOR .  get_include_path());

 

This this will make things right with the universe.

 

if you need access to the directory above this add it at the end, before the get_include_path()

 

Joseph Melnick

JM Web Consultants

Toronto, Ontario, Canada

 

 

Hello el-sid,

 

I think the problem may be with this line:

 

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib');

 

the Zend Framework is one more directory below where it usually is in your setup.

 

I would be inclined to add that sub folder to the include path like this:

 

set_include_path( dirname(__FILE__)  . '/lib/vendor'  . PATH_SEPARATOR .  get_include_path());

 

This this will make things right with the universe.

 

if you need access to the directory above this add it at the end, before the get_include_path()

 

Joseph Melnick

JM Web Consultants

Toronto, Ontario, Canada

 

Hi, thanks for the reply. you were right in that i needed to add the vendor directory and your solution worked. My intention was to try and autoload the entire lib directory as some of my classes will be located at the lib root directory. So i gather in order to autoload the entire lib directory

i would have to include another path -this time to the lib yes?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.