While displaying PHP Errors and warnings can be useful for debugging your website, you may not want to have them on all the time. These messages can be turned off in several ways. Let's go over them in detail:
Option 1 - WordPress Configuration File
If your website is WordPress-based, go to the File Manager and open your public_html/wp-config.php file. Next, check if any of these lines are present:
If either one of them or both are present, remove them. Next, add the following code:
ini_set('error_reporting', E_ALL );
That's it, now PHP errors will not be displayed on your WordPress website 😊
Option 2 - .htaccess File
php_flag display_errors off
Save the changes and now the PHP errors will no longer be displayed on the website.
Option 3 - .php File
If you want to hide PHP errors from a single session or page of your website, go to the File Manager and open the desired page's .php file. Next, add the following line:
Save the changes, and now the PHP errors will be hidden in this particular page.