What is PHP?
PHP is a language that many websites use to build pages. WordPress is written in PHP. When PHP finds a problem, it prints a message that tells you the file and the line number.
How to read an error
A message usually has four parts. The type, the problem, the file name and the line number. Start with the file and line. That is where PHP gave up.
The main types
- Notice: a small hint. For example, you used a variable (a named box that holds a value) that was never filled. The page still works.
- Warning: something is wrong, but PHP keeps going. For example, a file it tried to include is missing.
- Deprecated: the code uses an old feature. It works now but may stop in a newer PHP version.
- Fatal error: PHP must stop. The page often shows blank or broken.
- Parse error: PHP cannot read your code because of a typing mistake.
Messages you will see often
- Parse error: syntax error, unexpected ... You forgot a semicolon, bracket or quote. Look at the line shown and the line just above it.
- Call to undefined function You used a function that does not exist. Check the spelling, or a needed PHP extension may be switched off.
- Undefined variable You used a variable before giving it a value. Set it first.
- Cannot modify header information - headers already sent Something was printed before a redirect or cookie. Even a blank space before
<?phpcan cause it. - Failed to open stream: No such file or directory The file path is wrong. Check the name and the folder.
- Allowed memory size exhausted The script needs more memory than allowed. Raise the memory limit.
- Maximum execution time exceeded The script ran too long. Make it lighter or raise the time limit.
How to find the message
- Log in to cPanel if your plan has it.
- Open Errors to see the latest errors, or look for a file named
error_login your site folder. - Read the newest lines first.
Tip: Take a backup before you edit any code file. One wrong character can break the page.
Quick recap
- Every error names a file and a line. Start there.
- Notices and warnings are mild. Fatal and parse errors stop the page.
- Most fixes are small: a missing symbol, a wrong path or a low limit.
- Check the error log when the page is blank.