How to Stop WordPress From Displaying PHP Errors Using cPanel

The most common practice of troubleshooting of a WordPress website is to enable debugging, which displays PHP errors on a website.

You can even see the syntax errors inside your wp-admin area. It can be frustrating for a non-techie person. And some errors don't affect the website, so you don't need to keep the debugging enabled.

In such a situation, you should stop WordPress from displaying PHP errors. As you already know, WordPress is a PHP-based platform, and its plugins and themes also consist PHP, to debug anything, developers use the advanced features.

But when you're trying to solve the errors related to the server, 404 error, 403 forbidden error, etc. You don't need to see PHP errors.

In this tutorial, you're going to learn about disabling debugging from cPanel of your web hosting. You can also edit the wp-config.php file from your WordPress dashboard, but for security reasons, most of the companies disable file editing.

So, you'll need to learn the cPanel method.

Learn the Importance of wp-config.php

Now and then, you may encounter with an article explaining the process to accomplish a task using wp-config.php, it's not an ordinary file, it controls more than just the connection between a website and its database.

If you have ever noticed, the file consists of the SALT Keys and many other codes, which play an essential role in managing your WordPress site.

Today, you need to learn about the convenient way to edit the wp-config.php file. You can either use an FTP server or directly access it from cPanel.

I would recommend the cPanel method. Follow the steps.

Step 1:

Open your cPanel account offered by your web hosting company and try to search the file manager. Depending on the company you use, the layout may be different.

How to Stop WordPress From Displaying PHP Errors Using cPanel

You might also see the file manager icon in the different section. There is nothing to worry about; you can easily find it.

Some people get confused because of the different cPanel design. Well, don't be. Options are all similar.

Step 2:

On this new page, you can see many files and folder, but you have to check if you're in the public_html directory, if not, click on it from the left-hand sidebar.

How to Stop WordPress From Displaying PHP Errors Using cPanel

By default, you may see the home directory, so you need to navigate.

Step 3:

Search for the wp-config.php file and right-click to edit. Finding a file isn't so hard.

How to Stop WordPress From Displaying PHP Errors Using cPanel

If you have multiple websites running on the same server, you need to open the root directory of the website you want to work on, mostly, it's the folder with the name of a domain.

Step 4:

You can see a dialog box to disable encoding. Click on the Edit button to proceed.

How to Stop WordPress From Displaying PHP Errors Using cPanel

Step 5:

A new tab opens up on your browser, and you can see all the coding available inside the wp-config.php file. Here, you need to find "WP_DEBUG."

As your website already shows PHP errors, the code is as follow.

define('WP_DEBUG', true);

The code mentioned above enables the PHP errors to display on your site, but you need to disable them. So, replace it with a new code.

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

Click on the Save Changes button from the top-right corner, and you're all set. Now, if you clear your browser cache and check your website, you don't see any PHP error message.

Congrats, you have successfully disabled PHP errors from displaying on your WordPress site.

I Hope You Don't Face Any Difficulty in Disabling PHP Errors

Every time I create a new tutorial, I feel like achieving something. If you follow the steps with screenshots, you can accomplish your goal.

I remember when I freaked out after seeing so many coding lines on my website's dashboard. I didn't know such a trick that time, but I do, now.

Conclusion

You don't need to worry whether you have coding skills or not. All you need is copy and paste the code inside the wp-config.php file.

As I have mentioned, you have to find the debug code and replace it with a new code. There is nothing complicated. I hope you don't find anything brainstorming.

Check out these top 3 WordPress hosting services:

Was this article helpful?