When a fatal error hits, PHP stops at the reported line and never renders the rest of the page. On a live site, where error display is (rightly) off, visitors get a blank page or a 500 error, and WordPress shows “There has been a critical error”. So every fix starts with the error log.
What the error means
A full message looks like this:
PHP Fatal error: Uncaught Error: Call to a member function format() on null in /home/user/public_html/app/Report.php:42
Stack trace:
#0 {main}
thrown in /home/user/public_html/app/Report.php on line 42
- Uncaught Error: the error type. It can also be
TypeError,ArgumentCountErrororValueError. - The text after it: what went wrong. This is the key part.
- Path and line: where execution stopped.
- Stack trace: the chain of calls that led there. The first frame inside your own code, not inside
vendor, is usually where to look.
Common causes
| Part of the message | Cause | Fix |
|---|---|---|
Call to undefined function |
PHP extension not enabled, or function removed | Call to undefined function |
Class "..." not found |
Composer autoload or wrong path | Class not found |
Allowed memory size ... exhausted |
Out of memory | Allowed memory size exhausted |
Maximum execution time ... exceeded |
Ran too long | Raise the limit or split the task |
Call to a member function x() on null |
Variable is null instead of an object | Check the object exists before using it |
Cannot redeclare function |
Same function defined twice | function_exists() or require_once |
must be of type array, null given |
PHP 8 rejects the wrong value type | Fix the value or update the code |
How to fix it
- Find the full message: in cPanel open Metrics › Errors, or open the
error_logfile in the script’s folder via Files › File Manager. - Read the file, line and stack trace, and find the first frame that belongs to your code or plugin.
- Ask what changed: a plugin update, a new deploy, or a PHP version switch. If it started after changing versions, switch back temporarily under Software › Select PHP Version, then fix the code.
- Fix by type using the table above. Example for the null case:
$user = findUser($id);
if ($user === null) {
http_response_code(404);
exit('User not found');
}
echo $user->getName();
// or in PHP 8: echo $user?->getName();
- Hide errors from visitors, log them instead: in Software › MultiPHP INI Editor set
display_errorsto Off andlog_errorsto On. Showing errors on a live site leaks file paths and other sensitive details.
Prevention
- Run the same PHP version locally as on the server, and declare it in
composer.json, for example"php": "^8.2". - Test major updates on a staging copy before the live site.
- Read the migration notes when moving between PHP versions; see choosing a PHP version.
- Check the error log regularly: today’s deprecation warnings become tomorrow’s fatal errors.
On ArabyHost
You can choose PHP 8.1, 8.2 or 8.3 per site and switch back if an error appears after a change. The Araby AI assistant in the panel reads the error log and explains the fatal error and how to fix it. On AI/Developer plans you get SSH jailed in CageFS with Git and Composer, so you can follow the log live with tail -f error_log. JetBackup keeps a daily backup to return to if an update breaks the site.
FAQ
What's the difference between a Fatal error and a Warning in PHP?
A Warning doesn't stop the script: execution continues and you may get partial output. A Fatal error halts execution right at the reported line, and nothing after it runs.
Why did fatal errors appear after upgrading to PHP 8?
PHP 8 turned many old warnings into TypeErrors and removed legacy functions such as each() and create_function(). Update the code or plugin to a version that supports PHP 8.
Where is the error message if the page is blank?
In cPanel under Metrics › Errors, or in the error_log file in the script's folder. Laravel logs to storage/logs/laravel.log, and WordPress to wp-content/debug.log when WP_DEBUG_LOG is on.