PHP: Class not found, although file is loaded

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
peter_b
Chatterbox
Posts: 383
Joined: Tue Nov 12, 2013 2:05 am

PHP: Class not found, although file is loaded

Post by peter_b »

[PROBLEM]
Instantiating a class, gives me the following error - although the class file is loaded:
PHP Fatal error: Class 'MyClass' not found in MyClass.php on line 13
[SOLUTION]
Check if if the class name defined in its file is actually correct.

In my case, the error was similar to:

Code: Select all

class MyClasss
{
...
}
As you see, there's a typo in "MyClass.php":
The name "MyClasss" does not match "MyClass". :D
Post Reply