Learn how to conceal PHP errors and warnings on your website with this tutorial. While PHP errors and warnings can assist in website troubleshooting, you might not require them at all times. Various methods can be employed to disable these warnings and errors.
Let us find some different ways to hide errors and warnings on website:
- Using .htaccess File-
- Choose the “File Manager” option and open “public_html/.htaccess” file.
- In the absence of the .htaccess file, you can create one. Add the following lines-
php_flag display_errors off
- Then, click “Save”. This will ensure that PHP errors are no longer visible on your website.
- Using WordPress Configuration file-
- For WordPress-based websites; choose “File Manager” and access the public_html/wp-config.php file.
- Verify the presence of the following lines-
- If either line exists, delete it and replace it with the following code-
ini_set(‘error_reporting’, E_ALL );
- PHP errors will now be hidden from view on your WordPress website.
- Using .php file-
- To conceal PHP errors from a specific page of your website, choose “File Manager” and access the necessary page’s “.php” file.
- Add the below line-
- Save the modifications, and PHP errors will be hidden on this specific page.
That is it!