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 do I reset Joomla administrator password?

PHP Scripts | Updated 2026 If you have lost your Joomla administrator password and cannot log...

Joomla Warning: Parameter 2 to frontpage()

Obsolete | 2026 This Article Is Outdated This error affected Joomla 1.5 and 2.5, both of...

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

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



Save 30% on web hosting - Use coupon code Hosting30