0

I am searching for a solution to hide or disable the showing of exceptions on a production server.

In my configuration I have set

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off

but exceptions still appear.

Maybe it has something to do with the setting of set_exception_handler() in my app. I use a custom exception handler but I'm not sure if overrides the effect of display_errors and error_reporting.

How can I disable the exceptions for my production server?

tzortzik
  • 4,993
  • 9
  • 57
  • 88
  • This question has already been answered [here][1] [1]: http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php – Westranger Sep 12 '14 at 08:19
  • This is the opposite of what I want. I want to hide the exceptions. – tzortzik Sep 12 '14 at 08:23
  • Making sure there are no errors in your code to begin with is where it starts, of course. Either way: `error_reporting = 0`, or `E_ERROR`(closest to 0) and display_errors = false, or if your PHP version permits it: `display_errors = stderr`, to send it to the stderr stream, instead of stdout. – Elias Van Ootegem Sep 12 '14 at 08:26
  • Do you mean error/warning/notice messages, or do you mean exceptions? The two are very different things – Mark Baker Sep 12 '14 at 09:13
  • Then you need to set an [exception handler](http://www.php.net/manual/en/function.set-exception-handler.php), and/or actually use try/catch blocks in your code – Mark Baker Sep 12 '14 at 09:17
  • I did. I catch the exception and I don't want to print it anymore. I thought it may be from PHP configuration but I see that I need to implement something to avoid the printing. – tzortzik Sep 12 '14 at 15:39

0 Answers0