Jump to content

class not found


phpignorant

Recommended Posts

Hi , I am trying to modify some open source code . I create an index.php file and I am just trying to instantiate some classes in there . So what I have is some directory like    root/dir1/dir2/SomeClass.php

 

and from root/index.php i try new SomeClass() , but I get class not found . I tried doing an include but the problem just seems to cascade onto the next file , like some class in SomeClass.php is then also not found . The paths look correct to me . Anyone know what this is about ?

Link to comment
https://forums.phpfreaks.com/topic/239836-class-not-found/
Share on other sites

I can fix my reference to SomeClass() with an include . The problem is now other references inside SomeClass() are broken for some reason . I didn't create SomeClass() . It and the other files already came together so I am puzzled by why all the references are broken now ...

 

I get error that says reference inside SomeClass() called SomeInterface() can't be found and I check the path and it is fine . Is there some project settings I need to do ?

 

Or do i need to make an include inside index.php for every single file in the project ? I figured if I included SomeClass.php and SomeClass.php includes the files it needs , that should be the end of the matter . There are a probably 100 or more directories and files there . That is too many ; there must be an easier way . I am lost on what is going on here .

Link to comment
https://forums.phpfreaks.com/topic/239836-class-not-found/#findComment-1232051
Share on other sites

Well , here is the exact error I get when I call MManager.php ( i fixed the reference to MManager.php ) . The path to Kernel.php looks good unless those need to be backslashes not forward slashes ?

 

error

Warning: require_once(root/system/kernel/Kernel.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\LDAP_import\root\system\services\MManager.php on line 81

 

Fatal error: require_once() [function.require]: Failed opening required 'root/system/kernel/Kernel.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\LDAP_import\root\system\bootstrap\MManager.php on line 81

Link to comment
https://forums.phpfreaks.com/topic/239836-class-not-found/#findComment-1232336
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.