Jump to content

Autoload giving PEAR error


beingalex

Recommended Posts

Hi guys.

 

Is there any reason why:

 

function __autoload($class_name) {
    require_once  $class_name . ".class.php";
}

 

is returning:

 

Warning: require_once(PEAR_Error.class.php) [function.require-once]: failed to open stream: No such file or directory in E:/blah blah blah/index.php on line 9

 

The class name "LiveGallery.class.php" is in the right location. I'm tearin my hair out!

 

Thanks for any help in advance

 

- Alex

 

Link to comment
Share on other sites

Something IS trying to require a PEAR_Error class, so look for it.

For PEAR working correctly you need a slightly different autolaoding function, because they use a different naming scheme.

Link to comment
Share on other sites

Hi guys.

 

Is there any reason why:

 

function __autoload($class_name) {
    require_once  $class_name . ".class.php";
}

 

is returning:

 

Warning: require_once(PEAR_Error.class.php) [function.require-once]: failed to open stream: No such file or directory in E:/blah blah blah/index.php on line 9

 

The class name "LiveGallery.class.php" is in the right location. I'm tearin my hair out!

 

Thanks for any help in advance

 

- Alex

 

function __autoload($class_name) {

    require_once  $class_name.".class.php";

}

 

is ".class.php"? try "class.php"

Link to comment
Share on other sites

Hi nhojeinnor,

 

That wasn't it either. :-( However...

 

I've worked it out...

function __autoload($class_name) {
    $location = "inc/func/components/{$class_name}/{$class_name}.class.php";
    if (file_exists($location)) require_once $location;   
}

 

Wacked a check to see if the file exists. It was looking for PEAR_Error but I don't have it.

Still a little baffled about this but I think it was because I dont have PEAR installed.

 

Anyhoo! That'll do for now.

 

Thanks :D

Link to comment
Share on other sites

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.