Error logs are essential for diagnosing website problems. This guide shows you how to find, read, and use error logs in cPanel.
Types of Error Logs
| Log Type | Contains |
|---|---|
| Error Log | PHP errors, server errors, permission issues |
| Access Log | All HTTP requests to your site |
| Apache Error Log | Web server errors |
Viewing Errors in cPanel
- Log into cPanel
- Go to Metrics section
- Click Errors
- Recent errors display (last 300 entries)
Finding Error Log Files
Log files are located in your home directory:
/home/username/logs/error.log /home/username/public_html/error_log
In File Manager, navigate to these locations to view full logs.
Understanding Error Messages
PHP Fatal Error
[date] PHP Fatal error: Uncaught Error: Call to undefined function
Meaning: Script tried to use a function that does not exist
Fix: Check for missing plugins, extensions, or typos
PHP Warning
[date] PHP Warning: include(file.php): failed to open stream
Meaning: File include failed but script continued
Fix: Check file path and permissions
500 Internal Server Error
[date] AH01630: client denied by server configuration
Meaning: Server configuration blocking request
Fix: Check .htaccess rules
Permission Denied
[date] (13)Permission denied: file permissions deny server access
Meaning: File/folder permissions too restrictive
Fix: Set files to 644, folders to 755
Memory Exhausted
[date] PHP Fatal error: Allowed memory size of X bytes exhausted
Meaning: Script needs more memory than allowed
Fix: Increase memory_limit in PHP settings
Common HTTP Error Codes
| Code | Meaning | Common Cause |
|---|---|---|
| 403 | Forbidden | Permission denied, .htaccess rules |
| 404 | Not Found | File missing, wrong URL |
| 500 | Internal Server Error | PHP error, .htaccess syntax |
| 502 | Bad Gateway | Backend server issue |
| 503 | Service Unavailable | Server overload, maintenance |
| 504 | Gateway Timeout | Script timeout, slow backend |
Enabling PHP Error Display (Development Only)
Temporarily show errors on screen:
// Add to top of PHP file
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Warning: Disable this on production sites!
WordPress Debug Mode
Enable in wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Errors are logged to wp-content/debug.log
Troubleshooting Steps
- Check error logs first
- Note the exact error message and file/line number
- Search the error message online
- Check recent changes (updates, new code)
- Test in a staging environment
- Restore from backup if needed
Clearing Error Logs
If logs become too large:
- Download the log for reference
- Open File Manager
- Edit the error_log file
- Delete contents and save (or delete the file)
Tip: Set up log rotation to prevent logs from growing too large.