How can you prevent the display of PHP errors on a production website while still logging them?

  • Set display_errors to Off in PHP configuration
  • Use error_reporting(E_ALL) to suppress error display, while configuring a custom error handler for logging
  • Enable error_reporting(E_ALL) to display errors only for the admin
  • Use PHP's debug_backtrace() to hide errors from public view, while logging them
To prevent the display of PHP errors on a production website while logging them, you should configure a custom error handler to log errors and set display_errors to Off in the PHP configuration.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *