PHP Errors Explained
The Main PHP Error Levels
PHP errors are messages the interpreter produces when code does something it should not, or when something goes wrong while the script runs. Each error belongs to a level that shows how serious it is and whether the script can keep running. The levels are set through the PHP configuration, so the same bug can be visible on one server and silent on another.
- Notices and warnings flag problems the script can usually continue past, such as reading an array key that does not exist. Warnings are more serious, such as a file that could not be opened.
- Deprecation notices warn that a feature will be removed in a future version.
- Fatal errors stop the script immediately, for example when a required class is missing or a memory limit is exceeded.
Recent PHP versions report many former notices as warnings, so a site that looks quiet on an old version may show messages after an upgrade.
Displaying Errors Versus Logging Them
Two settings decide what happens to an error. display_errors controls whether the message is printed into the page for the visitor to see. Logging settings control whether the message is written to a file that the site owner can read. A separate reporting level decides which error levels are considered at all. All of these are described in php.ini.
On a live site, showing errors to visitors is a risk. Error messages can reveal file paths, database details or software versions that help an attacker. Good practice is to hide errors from the page and log them to a private file. Development environments do the opposite, showing errors at once so developers can fix them quickly.
Frequently asked questions
Why do I see a blank white page with no message?
A common cause is a fatal error with display of errors turned off, which hides the message from visitors. The error is still recorded if logging is enabled, so the site's error log is the place to look. The blank page means the setting is working as intended, but diagnosing the problem requires access to the logs.
Should I turn off PHP warnings completely?
Hiding warnings from visitors is good practice, but disabling error reporting entirely is not. Warnings often point to bugs that cause failures later. Keep them logged, review the log regularly and fix the causes, especially deprecation notices before a major upgrade. Teams often check these in a staging environment first.