in reply to Getting random "Internal Server Errors"

See CGI Help Guide, Before doing anything else add this code to the top of your script.
  • Comment on Re: Getting random "Internal Server Errors"

Replies are listed 'Best First'.
Re^2: Getting random "Internal Server Errors"
by polki (Novice) on May 05, 2009 at 20:26 UTC
    Thanks for trying to help, but you should really read before writing...
    1. I already mentioned that the script running as standalone produces no errors, only in connection with an AJAX-request
    2. I already mentioned, that if i actively add errors, they are shown in the server log. Even the link you posted says "You could look in the server logs to get the same information..."
    3. Because of 1 and 2 we can assume the script itself is ok and the problem is somewhere in the surroundings as somebody already stated
      Because of 1 and 2 we can assume the script itself is ok and the problem is somewhere in the surroundings as somebody already stated
      I'm sorry, but you cannot assume that. You could if the error was 502 Bad Gateway, but a 500 Internal Server Error means your program is broken.

      To figure out where, add this code to the top of your script

      BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); }
      Or add this
      BEGIN { use CGI::Carp qw(carpout); open(ERROR_LOG, ">>my_error_log") or die("my_error_log: $!\n"); carpout(\*ERROR_LOG); }
        Ok, added your lines (the second ones, because the first ones won't work. Remember this script is called by a javascript AJAX-call that expects a return value to do something with. The errors would never get to the browser in this case). I performed the AJAX-request several times, some worked, some produced the error. Nonetheless the logfile was EMPTY, error.log of the webserver didn't show anything either.
        Just to make one thing more than clear again: I replaced the whole script by this:
        #!/usr/bin/perl print "123test";
        That was ALL. Nothing else.
        Now again i called it several times, some times worked, some times "500 Internal Server Error".
        Now does this REALLY mean that the script itself is broken? If so, where is this script broken?