Turn off PHP error messages via htaccess

PHP | Updated 2026
Quick Answer

To disable PHP error messages from displaying on your website, add this to your .htaccess file:

php_flag display_errors Off
php_flag log_errors On

This hides errors from visitors while still logging them to your error log (viewable in cPanel > Metrics > Errors). On our CloudLinux servers with PHP Selector, you can also toggle display_errors directly in cPanel > Select PHP Version > Options.

For more .htaccess techniques:

Complete Guide to .htaccess on Apache

This article has been consolidated into our .htaccess guide for easier reference.

  • 144 Users Found This Useful

Was this answer helpful?

Related Articles

Strict Standards Error in Joomla

PHP Scripts | Updated 2026 Strict Standards errors in Joomla (such as "Strict Standards:...

Best WP Plugins

WordPress | Updated March 2026 Here are the most recommended WordPress plugins across the...

Tiki Wiki: Notice: Only variable references should be returned by reference

PHP Scripts | Updated 2026 The "Notice: Only variable references should be returned by...

How to reset the admin password in Drupal

PHP Scripts | Updated 2026 If you are locked out of your Drupal admin panel, you can reset...



Save 30% on web hosting - Use coupon code Hosting30