How to trap program crashes with HTTP error code 5

2019-09-11 23:39发布

问题:

I have a number of badly written perl programs serving up my websites. Occasionally they crash and the user sees ...

Software error: Yadda yadda yadda. For help, please send mail to the webmaster (webmaster@mywebsite.com), giving this error message and the time and date of the error.

I don't have access to that email address and even if I did those naughty users cannot be trusted to report this error.

So what I would like to do is get this error to trigger a HTTP error 500, so that I can monitor it with a line in the htaccess file like ...

ErrorDocument 500 /fixThisBug.shtml

回答1:

Thanks to ThisSuitIsBlackNot for the direction.

The perl programs all have

use CGI::Carp(fatalsToBrowser);

Which stifles the HTTP 500 error. Simply removing this will allow the programs to crash "properly".