Troubleshooting · Guide
How to Find and Read PHP Error Logs on Your Host
Short answer
Turn on WordPress logging with WP_DEBUG and WP_DEBUG_LOG in wp-config.php, then read wp-content/debug.log, or open your host log viewer instead. The newest fatal error line names the file and line that broke, and the folder after wp-content/plugins/ names the plugin at fault.
Key takeaways
- WP_DEBUG_LOG writes to wp-content/debug.log only when WP_DEBUG is also true.
- Set WP_DEBUG_DISPLAY to false so errors go to the file and never show on live pages.
- cPanel Errors shows the latest 300 entries, Kinsta keeps logs up to 4 days, and WP Engine shows the last 24 hours.
- The folder after wp-content/plugins/ in a fatal error line names the plugin at fault.
- Turn logging off and trim debug.log after the fix, so old lines do not hide new ones.
What is a PHP error log?
A PHP error log is a text file that records PHP errors, warnings, and notices with the date, the file, and the line number where each one happened.
When a page breaks, the browser often shows a blank page or a short message such as a 500 error. The log holds the detail the browser hides. It names the file and the line that failed, so you can fix the cause instead of guessing.
WordPress has its own log, called debug.log, and your host keeps a separate server log. The two files overlap but are not the same. WordPress writes its log only when you turn debugging on, while the host log records server errors whether or not WordPress debugging is on.
A log line usually looks like a timestamp, an error type, a message, and a file path. A fatal error line names the plugin or theme folder in the path, which points you at the cause in seconds.
What do you need before you start?
You need file access to your site and a note of the exact time the error happened.
File access means SFTP, FTP, or your host file manager. You need it to edit wp-config.php and to open wp-content/debug.log. If you have no file access, use your host log viewer instead, since that needs only the hosting dashboard.
Note the time the error happened, including the time zone. Logs are time-stamped, and matching the log time to the moment the page broke is the fastest way to find the right line. Kinsta, for example, keeps logs for up to 4 days, so an old error may already be gone (Kinsta server logs docs).
Take a backup of wp-config.php before you edit it. A typo in that file can break the whole site. Download a copy to your computer first, so you can restore it in seconds.
Plan on 15 to 30 minutes for the whole job. Turning logging on takes about 5 minutes. Reading the log and matching the error to a plugin takes the rest.
How do you turn on WordPress error logging?
You turn WordPress error logging on by adding three lines to wp-config.php, above the line that says “That is all, stop editing!”.
WordPress offers three constants for this job. The developer docs for wp_debug_mode() state that by default WP_DEBUG and WP_DEBUG_LOG are set to false, and WP_DEBUG_DISPLAY is set to true.
They also state that WP_DEBUG_DISPLAY and WP_DEBUG_LOG do nothing unless WP_DEBUG is true.
Add these lines to wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
WP_DEBUG turns debug mode on. WP_DEBUG_LOG writes errors to wp-content/debug.log. WP_DEBUG_DISPLAY set to false keeps errors off the screen, so visitors never see them.
That last line matters on a live site. With display left on, error text can appear on your pages, and it can expose file paths. The PHP manual advises using error logging in place of error display on production sites (PHP manual: error handling configuration).
The developer docs also note that WP_DEBUG_LOG can be a file path instead of true, a feature added in WordPress 5.1. That lets you point the log at a file outside the web root, which keeps it out of public reach.
Some hosts offer a debug switch in their dashboard instead. Kinsta, for example, lets you turn WordPress debugging on from the Tools tab in MyKinsta. If your host offers that switch, use it instead of editing the file by hand.
Turn logging off again when you finish. Delete the three lines, or set WP_DEBUG back to false. A live site should not keep debug logging on for weeks, because the log file grows and can fill disk space.
How do you read the WordPress debug.log file?
You read debug.log by opening wp-content/debug.log in a text editor after you reproduce the error.
First, reproduce the error by loading the broken page or repeating the action that failed. Then open the log file, and scroll to the end, since the newest lines sit at the bottom.
A typical fatal error line reads like this:
[21-Nov-2026 08:10:02 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted in /home/user/public_html/wp-content/plugins/example-plugin/includes/load.php on line 42
Read it in four parts: the timestamp tells you when it happened, the error type tells you how bad it is, the message tells you what failed, and the file path tells you where it failed.
The folder name right after wp-content/plugins/ names the plugin at fault. In the example above, it is example-plugin, while the folder after wp-content/themes/ names the theme at fault, and a path inside wp-includes or wp-admin usually points at core or at a plugin calling a core function.
If the file is large, search inside it for “Fatal error” or for the plugin folder name. Most text editors and file managers have a search box. Do not read the whole file from the top, since old warnings can fill hundreds of lines.
Delete or trim the log after you finish, and turn logging off. A stale log mixes old errors with new ones, which makes the next fault harder to find.
Where is the PHP error log on cPanel hosting?
On cPanel hosting, the PHP error log is in two places: the Metrics > Errors screen and an error_log file next to the failing script.
Open cPanel, then go to Metrics and click Errors. The cPanel Errors docs state that the screen shows up to 300 of the most recent entries in the web server error log, in reverse chronological order. That limit means old errors drop off the list, so check it soon after the error happens.
The Errors screen shows web server errors, not only PHP errors. A missing file shows as a 404 line, while a broken script shows as a 500 line. Click an entry to see its full message and timestamp.
For PHP errors, look for a file named error_log in the folder of the failing script.
PHP writes it next to the script that failed, so the home page writes to public_html/error_log and an admin page writes to public_html/wp-admin/error_log. Open it in File Manager and read the newest lines at the bottom.
If error_log does not exist, PHP may not have written one yet. PHP only creates the file when an error happens and logging is on. The PHP manual lists log_errors with a default of “0”, which means logging is off unless your host or WordPress turns it on.
Check Metrics > Raw Access as well if you need the access log. It records who requested which page and which status code came back, so you can match a 500 line to the exact request time.
Where is the PHP error log on managed hosts?
Managed hosts put the error log in their own dashboard, and each host keeps it for a different length of time.
| Host | Where to look | How far back |
|---|---|---|
| Kinsta | MyKinsta > Sites > site > Logs, error.log tab | Up to 4 days |
| WP Engine | User Portal > environment > Logs, Error tab | Last 24 hours |
| SiteGround | Site Tools > Statistics > Error Log | Latest 300 entries |
| cPanel host | cPanel > Metrics > Errors | Latest 300 entries |
Kinsta shows three log files in MyKinsta: error.log, kinsta-cache-perf.log, and access.log. The Kinsta docs state that log files are retained for up to 4 days and cannot be cleared by hand. They also state that error.log records PHP errors and warnings from your WordPress site.
Kinsta has one catch worth knowing. Its docs state that if WP_DEBUG is on in the Kinsta environment, all errors go to debug.log and nothing goes to error.log in MyKinsta. Turn WordPress debugging off if you want the host log to fill again.
WP Engine keeps PHP error logs in the User Portal. Its support guide for 500 errors says to click the environment where the error happened, then select Error Logs from the left-hand menu (WP Engine support: 500 error).
Its site-down guide states that you can find the last 24 hours of PHP error logs in the User Portal.
SiteGround shows the error log under Site Tools > Statistics > Error Log. SiteGround also creates a file named php_errorlog on its own.
Its knowledge base states that the file is created by itself if your PHP scripts produce non-critical errors or warnings, and it sits in the same directory as the script that produced them (SiteGround: WordPress error logs).
If your host is not listed here, search its help pages for “error log” or “server log”. The name changes, but the idea is the same: a Logs, Statistics, or Metrics screen holds the recent errors.
How do you read an error line?
You read an error line by matching its time, its type, and its file path to the fault you saw.
PHP error types fall into a few groups: E_ERROR is a fatal run-time error that stops the script, E_WARNING is a run-time warning that does not stop it, E_PARSE is a compile-time parse error, and E_NOTICE is a run-time notice about code that may be wrong.
A fatal error is the one to fix first. A page that shows a blank screen or a critical error message almost always has a fatal error line in the log. Warnings and notices can wait, unless they repeat on every page load.
Follow this order when you read a line:
- Check the timestamp first, and keep only lines from the time the fault happened.
- Look for “Fatal error” and skip warnings and notices for now.
- Read the file path, and note the plugin or theme folder name.
- Read the message, and note the function or class name it names.
- Search the log for the same file path to see if the error repeats.
Repeat lines point at a real fault. A single warning from a week ago is often noise. A fatal error that repeats every time you load a page is the cause.
If the line names a plugin file, deactivate that plugin and load the page again. If the error stops, you found the cause. Our guide on fixing a wp-admin lockout covers the fastest way back in when a fatal error locks you out of wp-admin.
What if the log is empty?
An empty log usually means logging is off, not that your site has no errors.
Check the three settings first. WP_DEBUG must be true, and WP_DEBUG_LOG must be true, for WordPress to write debug.log. The developer docs state that the log constant does nothing unless debug mode is on, so a true value on WP_DEBUG_LOG alone writes nothing.
Check the PHP side next. The PHP manual lists log_errors with a default of “0” and error_log with a default of NULL, which means PHP logs nothing until the setting changes. Your host sets these values in its PHP settings, so ask support if the server log stays empty.
Check the file path too. If WP_DEBUG_LOG holds a custom path, the log goes to that path, not to wp-content/debug.log. A wrong path can send the log to a folder that does not exist, and PHP then writes nothing.
Check the timing as well. Host logs keep only recent entries: Kinsta keeps logs for up to 4 days, WP Engine shows the last 24 hours, and cPanel shows the latest 300 entries. An error from last week may already be gone, so reproduce the fault and check the log right away.
If the log is still empty after all four checks, the fault may not be a PHP error at all. A DNS fault, a host outage, or a redirect loop leaves no PHP error line. Our guide on fixing the 500 internal server error covers the non-PHP causes in order.
What mistakes should you avoid?
The most common error-log mistakes waste time or expose your site.
First, do not leave WP_DEBUG_DISPLAY on for a live site. Errors on the screen can show file paths and database details to visitors. Set it to false, and read the log file instead.
Second, do not leave debug logging on after the fix. The log file grows with every warning, and a large file can fill disk space on a small plan. Turn it off, then delete or trim debug.log.
Third, do not share a full log file in public. Log lines can hold paths, user names, and query details. Copy only the lines that matter into a support ticket, and remove any passwords or keys first.
Fourth, do not fix the first warning you see. Warnings and notices are common in WordPress, and many come from plugins you cannot change. Fix fatal errors first, then repeat warnings that match the fault you are chasing.
Fifth, do not confuse the access log with the error log. The access log lists requests and status codes, while the error log lists what broke, so you need both to trace a fault, but only the error log names the file and line.
If a white screen appears with no log line, read our guide on fixing the white screen of death for the next steps.
Frequently asked questions
Is WP_DEBUG_LOG alone enough to log errors?
No. WP_DEBUG_LOG writes to wp-content/debug.log only when WP_DEBUG is also true. Set WP_DEBUG_DISPLAY to false as well, so errors go to the file and never appear on your pages.
How far back do host error logs go?
Kinsta keeps logs for up to 4 days, WP Engine shows the last 24 hours, and cPanel shows the latest 300 entries. Copy the lines you need soon after the error happens, because older entries drop off.
Why is my debug.log file empty?
That usually means logging is off. Check that WP_DEBUG and WP_DEBUG_LOG are both true, confirm log_errors is on in PHP, and check whether WP_DEBUG_LOG points at a custom path instead of wp-content/debug.log.
How do I read a PHP error line?
Read the timestamp, the error type, the message, and the file path. A fatal error line names the plugin or theme folder in the path, and that folder is the first place to look.
Is it safe to share an error log with support?
Yes, but only the lines that matter, and never in public. Log lines can hold file paths and user names, so remove passwords or keys and send only the matching lines to support.
Sources
- wp_debug_mode() WordPress Developer Resources
- Error Handling Runtime Configuration PHP Manual
- Server Logs Kinsta Docs
- Errors cPanel Docs
- How to Find and Access WordPress Error Logs SiteGround
- 500 Internal Server Error WP Engine Support
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
