A golden rule
First check whether everything is spelled correctly, that may save you much unnecessary time.
PHP Parse error: syntax error, unexpected end of file
PHP Parse error: syntax error, unexpected end of file in /xxx/xxx/xx.php on line xxx
That’s probably because you miss a right curly brace
} somewhere in the code. You can comment some code and limit down the range where error occurs.
Fatal error: Call to a member function xxx on null in xxx
Notice: Undefined variable: parser in /xxx/xxx.php on line xx PHP Fatal error: Uncaught Error: Call to a member function parse() on null in /xxx/xxx.php:xx
- Check whether the log also says
PHP Notice: Undefined variable: xxx in xxx. If it is, there are 2 cases:
- The variable is spelled incorrectly.
- The variable is not defined.
Check whether the object variable the function belongs to is initiated correctly.
Fatal error: Class ‘xxx’ not found
PHP Fatal error: Uncaught Error: Class 'modmdMyClass' not found in /xxx/xxx.php:xx
- Check whether you spell the class and the
- Make sure include the relevant file with
- Make sure include the relevant file in a correct order. Take a example,
a.phpuses something of
b.phpuses something of
b.phpdoes not include
c.phpfirst then include