View Full Version : Question about Perl - error log.

03-15-2004, 04:05 PM
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:


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

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.

03-15-2004, 09:04 PM
CGI::Carp is now part of the standard PERL distribution...see if you can use it.


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.


# 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|
<TITLE>$ENV{'SERVER_NAME'} - error_log</TITLE>
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";

03-16-2004, 02:05 AM
Nope still the same error >.<

Any more ideas?

Thanx in advance.