Mod Perl 500 Internal Server Error
Contents |
you've had a script running on a production server for a long time without problems, when the same grey perl internal server error -w screen starts to show up occasionally for no apparent reason. Figure
Perl Cgi Debug
21-1. Internal Server Error How can you find out what the problem is, before you actually attempt to apache2::const solve it? The first problem is determining the location of the error message. You have been coding in Perl for years, and whenever an error occurred in the past it mod_perl was displayed in the same terminal window from which you started the script. But when you work with a web server, the errors do not show up in a terminal. In many cases, the server has no terminal to which to send the error messages. Actually, the error messages don't disappear; they end up in the error_log file. Its location
Apache Loglevel
is specified by the ErrorLog directive in httpd.conf. The default setting is: ErrorLog logs/error_log where logs/error_log is appended to the value of the ServerRoot directive. If you've followed the convention we've used in this book and your ServerRoot is: ServerRoot /home/httpd/httpd_perl the full path to the file will be /home/httpd/httpd_perl/logs/error_log. Whenever you see "Internal Server Error" in a browser it's time to look at this file. There are cases when errors don't go to the error_log file. This can happen when the server is starting and hasn't gotten as far as opening the error_log file for writing before it needs to write an error message. In that case, Apache writes the messages to STDERR. If you have entered a nonexistent directory path in your ErrorLog directive in httpd.conf, the error message will be printed to STDERR. If the error happens when the server executes a PerlRequire, PerlModule, or other startup-time directive you might also see output sent to STDERR. If you haven't redirected Apache's STDERR, then the messages are printed to the console (tty, terminal) from which
kernel 2.6.18-164.el5 Last update: 6 years ago Can't seem to get TWiki configured. I have it installed and the "Welcome to TWiki" page comes up in the browser, but when I click on configure, it times out and eventually gives me a 500 Internal Server Error. My httpd log shows this: [Thu May 13 12:41:49 2010] [warn] [client 10.20.0.141] Timeout waiting for output http://modperlbook.org/html/21-1-2-Curing-Internal-Server-Error-Problems.html from CGI script /var/www/twiki.mydomain.com/bin/configure, referer: http://twiki.mydomain.com/ [Thu May 13 12:41:49 2010] [error] [client 10.20.0.141] Premature end of script headers: configure, referer: http://twiki.mydomain.com/ [Thu May 13 12:43:49 2010] [warn] [client 10.20.0.141] Timeout waiting for output from CGI script /var/www/twiki.mydomain.com/bin/configure, referer: http://twiki.mydomain.com/ I generated my twiki.conf from the Apache Config Generator. I http://www.twiki.org/cgi-bin/view/Support/SID-00838 did have to comment out one small perl section or else Apache wouldn't start up. See below: # We set an environment variable called blockAccess. # # Setting a BrowserMatchNoCase to ^$ is important. It prevents TWiki from # including its own topics as URLs and also prevents other TWikis from # doing the same. This is important to prevent the most obvious # Denial of Service attacks. # # You can expand this by adding more BrowserMatchNoCase statements to # block evil browser agents trying the impossible task of mirroring a twiki # # Example: # BrowserMatchNoCase ^SiteSucker blockAccess # BrowserMatchNoCase ^$ blockAccess BrowserMatchNoCase ^Accoona blockAccess BrowserMatchNoCase ^ActiveAgent blockAccess BrowserMatchNoCase ^Attache blockAccess BrowserMatchNoCase BecomeBot blockAccess BrowserMatchNoCase ^bot blockAccess BrowserMatchNoCase Charlotte/ blockAccess BrowserMatchNoCase ^ConveraCrawler blockAccess BrowserMatchNoCase ^CrownPeak-HttpAgent blockAccess BrowserMatchNoCase ^EmailCollector blockAccess BrowserMatchNoCase ^EmailSiphon blockAccess BrowserMatchNoCase ^e-SocietyRobot blockAccess BrowserMatchNoCase ^Exabot blockAccess BrowserMatchNoCase ^FAST blockAccess BrowserMatchNoCase ^FDM blockAcc
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta http://stackoverflow.com/questions/18120866/capture-specific-internal-server-errors-in-mod-perl Discuss the workings and policies of this site About Us Learn more https://wakaba.c3.cx/sup/kareha.pl/1109033191/ about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, internal server helping each other. Join them; it only takes a minute: Sign up Capture specific Internal Server Errors in Mod_perl up vote 1 down vote favorite My perl application currently has basic logging. I am using Mod_perl and CGI When an error occurs in the script the user gets an internal server error page. I know that CPAN CGI internal server error has an error reporting feature, but this feature seems to be for a individual script. What I wanted was to capture a stack trace globally and then report it to the user on a webpage. so that when this happens the user gets a nice 'something went wrong' page rather than a clueless Internal Server Error page. perl mod-perl share|improve this question asked Aug 8 '13 at 8:00 Sunny Patel 305411 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote I handled this nicely by creating bootstrap.pl script. I redirected with mod_rewrite all scripts to bootstrap.pl and posted actual url as parameter. In bootstrap I am handling sessions, logging, etc and in the end I am calling eval('script from url'). The most interesting for you is error handling: use ex::override GLOBAL_die => sub { my $stackTrace = Devel::StackTrace->new(no_refs => 1)->as_string; if ($stackTrace =~ /eval \{/) { CORE::die @_; } else { local *__ANON__ = "Exception"; select STDOUT; print getError500( sprintf( join("\n",), @_, $stackTrace, Dumper(\%ENV) ));
by Wakaba or Kareha themselves, but are still a big problem for lots of people, I'm setting up this thread to discuss various problems and solutions related to them. 2 Name: !WAHa.06x36 2005-02-21 17:54 ID:FqgLpoAw (Replies) [Del] Firstly, things that often cause Internal Server Errors:Wrong permissions on the .pl files. They should have 755 permissions. NOT 777, because that may cause some servers to refuse to run them.Incorrect hashbang. Most of the time, the default #!/usr/bin/perl is the correct one, but sometimes Perl is installed elsewhere. In that case, you will have to find out where, and change the hashbang. On Windows servers, it should often be changed to #!perl.Incorrect options set up for CGI scripts. The configuration for the directory should contain Options +ExecCGI and AddHandler cgi-handler .pl. SOMETIMES, but definitely not always, this can be put into the .htaccess file. See the next point.A broken .htaccess file. Spelling errors, trying to use modules that are not installed, or trying to use options that have been forbidden elsewhere will all cause Internal Server Errors.An incorrect mod_suexec install. Mod_suexec is very temperamental, and getting it to allow running of Perl scripts at all is very hard. Don't ask me, I have no idea how to configure it. 3 Name: !WAHa.06x36 2005-02-21 17:57 ID:FqgLpoAw (Replies) [Del] Secondly, things that DO NOT cause Internal Server Errors:Wakaba or Kareha themselves. Unless you've horribly mangled the scripts by hand, they will never cause an Internal Server Error. The only thing in the script file itself that can cause problems is the hashbang on the first line.Wakaba configuration. As a consequence of the above, no matter how badly you configure it, it should not cause an Internal Server Error.Missing software or modules. Missing mysql or ImageMagick will cause errors, but not Internal Server Errors. A missing Perl might, though, but that's not very likely to be a problem. 4 Name: !WAHa.06x36 2005-02-21 18:01 ID:FqgLpoAw (Replies) [Del] Third, what to do when you get Internal Server Errors?Look at error_log. Internal Server Errors often generate two or more lines in the log file, make sure you read them all.Try the Perl test script:#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "