If you are constantly getting php error messages and warning which are displaying on your website, then you can easily disable warning in php.ini file and make users doesn’t see warning and notices on your website by easily changing error reporting and disable warning in php ini file and warning and errors. So, lets see in detail how to disable warnings in php ini file.
How to disable warning in php ini?
Step 1: Open XAMPP control panel ->Click on config and select php.ini
Step 1: Open php.ini file in notepad editor.
Step 2: Press control + F and search for error reporting.
Step 3: In php ini file you will find error reporting = E_ALL_& ~E_NOTICE.
INFO: E_ALL_& ~E_NOTICE will display all errors, except for notices).
Step 4: Change the error reporting value error reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING);
Step 5: Go ahead and save php ini file and close php ini file.
Step 6: Restart your XAMPP server.
That’s it, Once you change these error reporting to following -> error reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING) then warnings will be disabled and php warnings will not show on your website.
Disable warning in php ini file but still showing warnings?
If you have changed or modified error reporting file to error reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ER… _ERROR and still you are seeing warnings, then make sure that you restart XAMPP server once. Once you make changes you need to restart your XAMPP server.
Why to disable warning in php ini file?
Php warning doesn’t affect the site functionality, they are only warnings which will be shown to front end user and user has nothing to do with those warning messages and instead it’s a very bad experience for user to show php warning on front end.
Turn off display error on to off using php ini file
To hide warnings and errors to display on front end and also not to generate php errors log file for php errors, then you can simply go ahead and open php ini file and search for display error and set it to OFF, once it is set to off then php errors warning will not be displayed on front end.
Change error reporting off using htaccess file?
You can also change php error reporting using htaccess file as well by adding a simple line of code you can disable warning -> php_flag display_errors off.
Yes! By adding a single line of code in php ini file you can turn off or disable php warning errors.
Open php ini file and search for error reporting and set to off to completely turn off all errors and to disable warning set error reporting to E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING)