Search code examples
perlcachingserverinternal-server-error

Internal server error after editing, but reuploading the originals does not fix


I'm helping someone remotely with a website. The major issue is that I cannot get hands on to debug the actual site. I made sure the code is bug free on my end, but bug is inevitable.

So currently the site is experiencing internal server error after updating some server script(in Perl). We reuploaded the originals and made sure the originals work, but the error persists.

I have never seen any situation like this. What else could be the issue here? Is there any sort of server cache?


Solution

  • Are you using mod perl? It has a nasty habit of caching broken code, restart the server to flush this out. Alternatively try renaming the script for testing purposes.

    Are you using apache? Server scrip errors will generally be logged to /var/log/httpd/error_log - ask the admin for this if you wont have access. Or get them to log error_log for your site to somewhere you can see/view.

    Additional techniques you may be able to use

    If not already, use warnings; use diagnostics; use CGI::Carp qw(fatalsToBrowser);

    Run from another page as a command line script, this is a hack to get an error message out from a closed environment.

    #!/usr/bin/env perl
    use CGI;
    
    my $cgi = CGI->new();
    print $cgi->header();
    print `myscript.cgi 'param1=hello&param2=world'`;
    

    Check system settings and version against your environment

    #!/usr/local/bin/perl
    
    print "Content-type: text/html\n\n";
    print "<pre>\n";
    
    foreach $key (sort keys(%ENV)) {
      print "$key = $ENV{$key}<p>";
    }
    print "</pre>\n";
    

    Outside of that you really need to get higher level access to the system, or reproduce the enviromnent in a vm you contirol.