Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2004
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question about Perl - error log.

    Hi guys,

    I get this error when I try running my perl script that is located on my web host.

    Its a 500 internal server error.

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, xxxxxxx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    The thing is... I dont have access to the server error log. And when I asked the Admin, he told me that for security reasons I'm not allowed to access it... so he told me to upload my own text file?!?!

    This is what the admin said:

    Hi,

    You can upload your own text file log files and link them to the
    program you are using. Some programs already have this feature built in when
    you install.

    Unfortunately we do not provide access as you generally need server
    admin control to view it.

    Sorry I couldnt help you more on this but we don't do any web design
    ourselves.
    Does anyone have any idea how I can go about doing this?
    I really need to check the error log to find out whats wrong with the script.

    Thank you in advance for any help.

  • #2
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CGI::Carp is now part of the standard PERL distribution...see if you can use it.

    place
    Code:
    use CGI::Carp qw(fatalsToBrowser);
    near the top of your script...this will trap errors to your browser so that you can see them without the error log.

    Also, you can probably write a small script to read your log file out for you, rather than accessing it directly.

    Code:
    #!/usr/local/bin/perl
    
    # Print out a content-type for HTTP/1.0 compatibility
    print "Content-type: text/html\n\n";
    
    #change this to the path of your error_log, should be fairly similar
    $error_log = "/var/log/httpd/error_log";
    
    #how many errors to display, default or querystring based
    if ($ENV{'QUERY_STRING'} eq "") {
    	$howmany = 10
    } else {
    	$howmany = $ENV{'QUERY_STRING'}
    };
    
    print qq|
    <html>
    	<head>
    		<TITLE>$ENV{'SERVER_NAME'} - error_log</TITLE>
    	</head>
    	<body>\n|;
    print "		<h3>Recent <a href=\"http://$ENV{'SERVER_NAME'}/\">$ENV{'SERVER_NAME'}</a> Server Errors</h3>\n<hr>\n";
    open (ELOG, "tail -$howmany  $error_log | tail -$howmany |") || die $!;
    while (<ELOG>) { 
      print; print "\n<HR>\n";
    }
    close (ELOG);
    print "<h3><a href=\"$ENV{'HTTP_REFERER'}\">Return Previous Page</a></h3>";
    print "	</body>\n";
    print "</html>\n";
    exit;
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #3
    New Coder
    Join Date
    Feb 2004
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Nope still the same error >.<

    Any more ideas?

    Thanx in advance.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •