Since WordPress runs on PHP, you can debug most of your WordPress errors using the PHP error logs. However, the PHP error logs may not always be available depending on the hosting plan in use. In this step by step tutorial, you will learn how to set up your PHP error logs.
To follow along with this tutorial, you will need the following:
- Access to your WordPress dashboard
- Access to your Website root folder
1. Log into your WordPress dashboard and navigate to the ‘Add New Plugin’ page. Search for ‘WP Log Viewer’ then install and activate the result as shown in the image below.
2. Once WP Log Viewer is installed and activated, you should see the ‘Debug Log’ option at the top bar. However, you will notice that it is disabled.
3. When you click on the disabled tab, you will be shown the instructions below to turn on debugging.
4. You now need to log into your C-panel then open the file manager as shown below:
5. Within your website root folder, highlight the ‘wp-config.php’ file then hit the ‘Edit’ button as illustrated below:
6. Once opened, you need to copy and paste the code below into the wp-config.php file as illustrated in the image below.
Hit ‘Save Changes’ button to save your changes as shown above.
7. You now need to navigate to the ‘WP-CONTENT’ folder located in your website’s root folder. Create a new file named ‘debug.log’ and save it in the wp-content folder as illustrated in the image below.
8. Head back into your WordPress dashboard and refresh the page. The Debug Log should now be enabled and any errors will be indicated. For instance, the image below shows two errors.
9. When you open the Log Viewer, the issues will be categorized to either warnings, notices or fatal errors. You can now research on the error and resolve it accordingly.
You now can now view PHP Error Logs conveniently on your WordPress dashboard. Share your feedback on the comment section below.