How to enable WP_DEBUG and read the WordPress debug log
When WordPress shows a blank page, a "critical error" message or a broken feature, the real cause is usually a PHP error that is hidden from visitors. Turning on WP_DEBUG and writing errors to the WordPress debug log lets you see exactly which plugin, theme or file is failing, without showing the errors to your visitors. This guide shows you how to enable WP_DEBUG safely on your EgWeb hosting, where to find the log, and how to read it.
Step 1: Back up and open wp-config.php
- Log in to cPanel (see How to log in to cPanel) and open File Manager.
- Go to the folder where WordPress is installed. For the main domain this is usually
public_html. - Right-click
wp-config.phpand choose Copy to make a backup copy such aswp-config.php.bak. - Right-click
wp-config.phpagain and choose Edit.
Step 2: Add the debug settings
Search the file for WP_DEBUG. Most installations already have a line like define( 'WP_DEBUG', false );. Replace that single line with the block below. If there is no such line, paste the block just above the line that says /* That's all, stop editing! Happy publishing. */.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
What each line does:
- WP_DEBUG turns on WordPress debug mode.
- WP_DEBUG_LOG writes every error to
wp-content/debug.log. - WP_DEBUG_DISPLAY set to false keeps errors off the screen, so visitors never see file paths or code.
WP_DEBUG already exists further down the file, edit it instead of adding a second copy. A duplicate define creates a new warning of its own.Click Save Changes.
Step 3: Reproduce the problem
Open the page that shows the error, or repeat the action that fails (saving a post, adding a product to the cart, activating a plugin). WordPress now records the error in the log.
Step 4: Read the debug log
- In File Manager, open
wp-contentand look fordebug.log. Click Reload if you do not see it yet. - Right-click it and choose View or Edit. The newest errors are at the bottom.
A typical line looks like this:
[06-Nov-2026 10:15:42 UTC] PHP Fatal error: Uncaught Error: Call to undefined function example_func() in /home/user/public_html/wp-content/plugins/some-plugin/includes/core.php:120
How to read it:
- Fatal error stops the page. This is what you must fix first. Warning, Notice and Deprecated lines are usually not the reason a site is down.
- The path tells you who is responsible.
wp-content/plugins/some-plugin/points to that plugin;wp-content/themes/your-theme/points to the theme. - The time stamp shows if the error is new or old. Focus on lines that appear when you reproduce the problem.
Step 5: Fix the cause and turn debugging off
- Update, replace or deactivate the plugin or theme named in the error. If you cannot reach the dashboard, rename the plugin folder in
wp-content/pluginsto disable it. - If the error mentions PHP functions that no longer exist, the code may not support your PHP version. See How to change the PHP version.
- When the site works again, set
WP_DEBUGback tofalseand deletedebug.log.
debug.log sits inside a public folder and can contain file paths and other details. Never leave debugging on for days. If you need it for longer, you can point the log to a folder outside public_html, for example define( 'WP_DEBUG_LOG', '/home/USERNAME/wp-debug.log' );, replacing USERNAME with your cPanel username.Common problems
- No debug.log appears: make sure you saved the file, that the lines are above the "stop editing" comment, and that you reproduced the error. Also check the
error_logfile in the site folder, which the server writes on its own. - The site shows errors on screen:
WP_DEBUG_DISPLAYis missing or set to true. Set it to false. - The log is huge: delete it, reproduce the problem once, and read the fresh file.
Frequently asked questions
Is it safe to enable WP_DEBUG on a live site?
Yes, for a short time, as long as WP_DEBUG_DISPLAY is false so visitors do not see the errors. Turn it off when you finish.
What is the difference between debug.log and error_log?
debug.log is written by WordPress when WP_DEBUG_LOG is on. error_log is written by PHP on the server and often shows the same fatal errors even when debugging is off. Check both.
Will debug mode slow my website?
Slightly, because every notice is written to disk. That is another reason to switch it off after troubleshooting.
If the log shows a server error instead of a WordPress one, also read How to fix a 500 Internal Server Error.
Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.