As you all know, WordPress is a PHP-based platform, and it may encounter with some common errors. You need to understand the concept of PHP errors.
While running a WordPress website, you may see different kinds of errors, and most of them include a PHP code. To understand them better, enabling the PHP errors to display on the site is a good troubleshooting technique.
Although a non-techie user may not understand PHP codes, still learning the basics is helpful. There are different methods to accomplish one task.
In this tutorial, you're going to learn about enabling error reporting using the php.ini file. You can either use cPanel or FTP.
Depending on your choice, you can choose any, but I am going to walk you through using cPanel.
A Step By Step Process to Enable PHP Error Reporting
Now and then, you may see tutorials about fixing an issue using cPanel. Most of the people get confused because every company has a different cPanel layout.
Well, no need to worry. Options available in cPanel are almost similar, companies only use a different design template to match their brand.
Let me start the process.
Login to your cPanel and open the file manager, which is available in the files' section. Depending on your web hosting company, you may see an independent file manager icon.
Click to open.
Make sure you open the root directory. When you click on the file manager, a new tab opens up in the browser, which shows the home directory unless you see a popup to choose the root directory.
You can navigate to pulic_html from the left-hand sidebar.
As you know, for a single domain, all the data resides in the public_html directory, but if you host multiple websites, you need to open the domain name's respective folder.
If you run only one site, search for the php.ini file and right-click to edit. As usual, you can also use the standard Edit link from the cPanel navigation menu.
A popup appears to provide an option to disable encoding. Click on the Edit button and proceed.
A new tab appears in the browser. Scroll down to find the error_reporting code. You see the coding lines in green because error reporting is disabled right now.
All you need is to remove ";" semi-colon sign in front of error_reporting. Let me show you the code when error reporting is disabled.
; -Show all errors, exceptfor notices ; ;error_reporting = E_ALL & E_Notice ;
Now, if we remove the semi-colon, the code becomes as follow.
; -Show all errors, except for notices ; error_reporting = E_ALL & E_Notice ;
Save the file. Here is the screenshot.
Now, you have successfully enabled the error reporting.
How to Enable Displaying Errors
You have enabled the error_reporting, but to display them, you need to change the value of the display_errors variable.
All you need is to set the value to "On". Let me show you the code when display_errors is not active.
display_errors = Off
To activate it, change the value, and the code becomes as follow.
display_errors = On
Click on the Save Changes button from the top-right corner of the screen, and you're done. You have successfully enabled error reporting for your WordPress site.
If you have an error, it's visible on your site.
Note: After enabling error reporting, even your users can see the PHP errors, so it's better to enable the maintenance mode.
I Hope You Can Start Troubleshooting PHP Errors
I understand, for a non-techie person, it can be scary to deal with coding and any error related to it. But, at some point, you need to learn.
Enabling error reporting helps you fix the error as soon as possible. You might keep deactivating plugins, but if you know the exact PHP error, you can find its cause in a short amount of time.
Editing the php.ini file is same as you do for .htaccess or wp-config.php. You need to make sure you are looking in the correct root directory.
I hope you can enable error reporting using the method. Keep exploring WordPress.