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

How to turn off magic quotes gpc for Joomla 3

PHP Scripts | Updated 2026 The magic_quotes_gpc setting was a PHP feature that automatically...

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...

Best WP Plugins

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

How do I reset Zen Cart administrator password?

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



Save 30% on web hosting - Use coupon code Hosting30