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

Best WP Plugins

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

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

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

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

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

PHPList Email Throttling

PHP Scripts | Updated 2026 PHPList is an open-source email newsletter manager. If your...



Save 30% on web hosting - Use coupon code Hosting30