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

PHP: Class not found, although file is loaded

Postby peter_b » Mon Nov 28, 2016 2:02 am

[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
  • 0

User avatar
peter_b
Chatterbox
 
Posts: 308
Joined: Tue Nov 12, 2013 2:05 am
Reputation: 3

Return to Knowledge Base

Who is online

Users browsing this forum: No registered users and 8 guests

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: No registered users and 27 guests

Reputation System ©'