PHP Fatal Errors-causes and how to debug
Fix PHP fatal errors: undefined function, memory limit, allowed memory exhausted, syntax errors in WordPress plugins.
On this page
A PHP fatal error stops the entire script and displays a "Fatal error" or blank white page. Unlike warnings (non-fatal), fatal errors prevent your page from loading at all.
Common fatal errors
- Call to undefined function: Plugin calls function that doesn't exist
- Allowed memory exceeded: PHP memory limit too low (default 128M)
- Class not found: Missing plugin file or incorrect include path
- Maximum execution time exceeded: Script takes too long
- Syntax error: Parse error in PHP code (missing semicolon, brace)
- Cannot redeclare function: Function defined twice (duplicate plugin code)
- Cannot use empty string as offset: Array access error in code
Enable PHP debug logging
For WordPress:
Add to wp-config.php (before "That's all"):
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false); // don't show errors to visitors
Error details will appear in /wp-content/debug.log
For generic PHP:
Add to .htaccess:
php_flag display_errors on
php_value log_errors on
php_value error_log /home/username/public_html/php-error.log
Read error logs
Via cPanel:
- Go to Logs → Raw Access Logs or Error Log
- Download the error log file
- Search for "Fatal" or "Call to undefined"
Via command line (VPS):
tail -50 /var/log/php-errors.log
tail -50 /home/username/public_html/debug.log
How to fix fatal errors
Undefined function
- Plugin missing required dependency
- Fix: Install the required plugin or disable the dependent plugin
Memory limit exceeded
- Increase in wp-config.php:
define('WP_MEMORY_LIMIT', '256M'); - Or increase in .htaccess:
php_value memory_limit 256M
Class not found
- Plugin file didn't load
- Fix: Check plugin is activated and main file is spelled correctly
Syntax error (parse error)
- Error log will show exact line number
- Check that line for missing semicolon, brace, quote
WordPress-specific fatal errors
White screen of death (WSOD) = fatal error
Enable WP_DEBUG to see what caused it. Usually a plugin conflict.
Disable all plugins to test:
- Via FTP: Rename /wp-content/plugins to /wp-content/plugins-old
- Visit your site - does it work?
- If yes, a plugin caused it. Rename back and disable plugins one by one
Check PHP version:
Some old plugins don't support PHP 7.4+. Upgrade the plugin or downgrade PHP version (via cPanel).
Don't ignore fatal errors - they mean your site is down to all visitors. Enable debug logging immediately to find the cause.
Related: Memory limit errors | Parse errors | WordPress troubleshooting
Still troubleshooting?
Use UnderHost tools for quick checks, or open a support ticket when the issue needs account or server access.





















