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

  1. Log in to cPanel.
  2. Click Select PHP Version.
  3. Click Switch To PHP Options
  4. Set display_errors to Off
  5. Click Save

.htaccess

  1. Edit .htaccess in your public_html folder
  2. Enter the following code:
    php_flag display_errors on
  3. Save the file.

php.ini

  1. Create a new file named php.ini in your public_html folder.
  2. Enter the following code:
    display_errors = off
  3. 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.