
How to Enable Debug Mode in WordPress via cPanel wp-config.php File
How to Enable Debug Mode in WordPress via cPanel wp-config.php File
What Is WordPress Debug Mode?
WordPress debug mode helps developers and site administrators troubleshoot issues by displaying PHP errors, warnings, and notices directly on your website or saving them to a debug log file. This mode is essential when fixing plugin conflicts, theme issues, or other errors.
Why Enable Debug Mode?
- Identify and fix PHP errors and warnings
- Help debug plugin or theme conflicts
- Improve site stability and performance
- Generate debug logs for detailed analysis
Step 1: Log into cPanel
Access your hosting cPanel by visiting https://yourdomain.com/cpanel
or through your hosting provider’s dashboard.
Step 2: Open File Manager
Once logged in, locate and open File Manager under the Files section.
Navigate to the root folder of your WordPress installation, typically public_html
or a subfolder if installed in a subdirectory.
Step 3: Edit wp-config.php File
- Locate the
wp-config.php
file in the root WordPress directory. - Right-click the file and choose Edit or select the file and click the Edit button from the top menu.
- In the editor, look for the line that says:
define('WP_DEBUG', false);
or if it doesn’t exist, prepare to add it.
- Change the line to enable debug mode by setting it to true:
define('WP_DEBUG', true);
- To log errors to a file instead of showing them on the website, add the following lines below it:
define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); @ini_set('display_errors', 0);
This will save errors to a debug.log file inside the
wp-content
folder without displaying errors to visitors. - Save the changes and close the editor.
Step 4: Check Debug Logs
If you enabled WP_DEBUG_LOG
, navigate to the wp-content
folder and open the debug.log
file to review error messages and notices generated by WordPress.
Step 5: Disable Debug Mode After Troubleshooting
For security and performance reasons, it’s important to disable debug mode once you have fixed the issues by setting WP_DEBUG
back to false:
define('WP_DEBUG', false);
Troubleshooting Tips
- If you don’t see the
wp-config.php
file, ensure you are in the correct directory. - Make a backup of
wp-config.php
before editing to avoid accidental site issues. - If you encounter permission issues, contact your hosting provider.
Conclusion
Enabling debug mode via cPanel is a powerful way to diagnose and fix WordPress problems. Always remember to turn off debugging after use to keep your site secure and optimized.