How to Hide PHP Errors and Warnings on Your Website

August 14, 2023 / Web Development

This guide explains how to hide errors and warnings on your website. The PHP errors and warnings may be helpful for repairing your website, but you may not need them all the time. These warnings and errors can be turned off using different methods.

Let us explore several ways to hide errors and warnings on your website-

  1. Using .htaccess File-
    1. Select the “File Manager” and open “public_html/.htaccess” file. If .htaccess file is not present, you can create one. Add the below outlined-
      php_flag display_errors off
    2. Click on the “Save”.
      This way, the PHP errors will no longer be present on your website.
  2. Using WordPress Configuration file-
    1. If the website is WordPress-based, select the “File Manager” and open public_html/wp-config.php file.
    2. Check if below outlined lines are present or not-
      define(‘WP_DEBUG’, true);
      define(‘WP_DEBUG’, false);
    3. If either line is present, remove it, and add the following code in its place:
      ini_set(‘error_reporting’, E_ALL );
      define(‘WP_DEBUG’, false);
      define(‘WP_DEBUG_DISPLAY’, false);Now the PHP errors will not be displayed on your WordPress website.
  3. Using .php file-
    1. To hide PHP errors from a single page of your website, select “File Manager” and open the required page’s “.php” file.
    2. Add the line given below-
    3. “Save” changes and now the PHP errors will not be seen in this particular page.

Hope you liked our article. For any query, get in touch with our support team. They are available for you 24×7.

Dominos Search