If you see a PHP warning on your website then it could be caused by a number of reasons. The error message usually gives you a good description of the cause of the error which your website developer can fix, or you can Google search for a resolution.
You can disable the PHP error message from showing on your website using the steps below.
PHP Selector in cPanel
- Log in to cPanel.
- Click Select PHP Version.
- Click Switch To PHP Options
- Set display_errors to Off
- Click Save
.htaccess
- Edit .htaccess in your public_html folder
- Enter the following code:
php_flag display_errors off
- Save the file.
php.ini
- Create a new file named php.ini in your public_html folder.
- Enter the following code:
display_errors = off
- Save the file.
Verify your changes
Create a phpinfo php page to check your settings are active.
My WordPress website still shows errors
Check your wp-config.php file has the following set:
define('WP_DEBUG', false);
PHP Error Log
With display_errors set to Off your website will no longer display the PHP errors. By default, php errors will still be logged in a file called error_log, which can be found in the same directory as the PHP script causing the error.
Until the PHP error is fixed or logging is disabled the error_log will continue to grow.