如何使用HTTP错误代码500捕获程序崩溃 [英] How to trap program crashes with HTTP error code 500
问题描述
我在我的网站上有许多写得不好的Perl程序。有时它们崩溃了,用户看到了...
I have a number of badly written perl programs serving up my websites. Occasionally they crash and the user sees ...
软件错误:
Yadda yadda yadda。
要获取帮助,请发送电子邮件给网站管理员(webmaster@mywebsite.com),并提供此错误消息以及错误的时间和日期。
我无权访问该电子邮件地址,即使我这样做,也无法信任那些顽皮的用户报告此错误。
I don't have access to that email address and even if I did those naughty users cannot be trusted to report this error.
所以我想要做的是得到此错误以触发HTTP错误500,以便我可以用htaccess文件中的一行监视它,例如...
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
ErrorDocument 500 /fixThisBug.shtml
推荐答案
感谢ThisSuitIsBlackNot提供的指导。
Thanks to ThisSuitIsBlackNot for the direction.
所有perl程序都有
use CGI::Carp(fatalsToBrowser);
扼杀HTTP 500错误。只需删除它即可使程序正确崩溃。
Which stifles the HTTP 500 error. Simply removing this will allow the programs to crash "properly".
这篇关于如何使用HTTP错误代码500捕获程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!