Requirements
Here are the requirements to run Error Log Viewer:
- UNIX web server
- Perl4 or higher
- The absolute path to your servers error log. Look in your main login directory for a directory called "logs" and a file called "error_log" for starters.
- Server log must be readable. Setting a CHMOD of 766 will usually accomplish this.
To Top
Please read the Perl Services Licensing Agreement
By downloading, purchasing, acquiring and/or implementing any PerlServices software, you agree to be bound by the terms and conditions of the distribution policy.
To Top
How to install the program
You need to do two things to install this program.
- Make sure the path to Perl is correct on the first line of the script.
- Around line #25 you will see the variable $ERR_LOG. You must set this variable to the
absolute path to the server's error log. You can find out what this absolute path is by
asking your SysAdmin or support personel. Some servers are un-necessarily paranoid, if they
refuse to give this path to you or do not have error logging enabled, read the following user guide
entry to see how to work around this in your scripts.
To Top
What if I can't get the path to the error log?
Some server administrators will not turn on the error logging on the web server. Additionally,
some are too paranoid to give out the absolute path to the error log. This is a pain but it's not a
problem. If you can't use the Error Log Viewer for this reason (or any other reason) then here is what
you can do to still make sense of the 500 errors you are getting.
First off, poke around your web space on the server. Look for a directory named "logs" or similar and see if there is a file in there called "error_log". That is the standard name for an error log on an Apache server. You just may find it on your own. I don't recommend you go outside of your own name space. That's just wrong.
If you can't find the error_log on your own, use the following code snippet in your scripts when you need to debug them.
What the following snippet of code will do is re-direct the messages being written to STDERR (to the error log) to
STDOUT (the web browser). Here is the code:
BEGIN {
$| = 1;
open (STDERR, ">&STDOUT");
print "Content-type: text/plain\n\n<PRE>";
}
|
Place this code anywhere in your script. It would be best if you put it at the top of your script, a couple lines below the path to Perl. The reason being is that
BEGIN statements are executed as soon as they are compiled by the Perl interpreter, even if the rest of the script hasn't been fully compiled yet. Therefore, if this BEGIN
block has been compiled and executed, and the Perl interpreter encounters a compile error, the error message will be printed out to your browser. This is why we put the BEGIN
block at the top of the script, just below the path to Perl, so that it is compiled and executed before anything else in the program.
Here is a sample script that will demonstrate how this is done:
#!/usr/bin/perl
BEGIN {
$| = 1;
open (STDERR, ">&STDOUT");
print "Content-type: text/plain\n\n<PRE>";
}
#
# Demo of compile error with error message
# re-directed to STDOUT
#
print "Content-type: text/html\n\n";
print "Hello World!\n;
exit;
|
You can see that in this sample code, we have purposefully created an error. On line 15 we did not put in the closing double quotation to terminate the print statement, a common cause of the "500: Internal Server" error.
Now execute the code to see the results
If the above BEGIN block doesn't execute and you still get an error, then there are two possible causes:
- You do not have the correct path to Perl at the top of your script.
- You did not CHMOD your Perl script. Make sure the Perl script is CHMOD 755.
We have included a copy of the "compile_error_demo.cgi" script in the Error Log Viewer zip file for your reference.
To Top
Support Information
If you are unable to set-up this program or are uncomfortable setting up the program then please contact our support department via the Support Centre page.
We offer an installation service for a fee, details of which are available at the Support Center. Note that due to the unpredictable nature of NT and Mac servers, we do not offer support or installation services for programs being installed on these types of servers. This program was written for a UNIX server.
If you do not receive a response from our support centre within 24 hours, please contact us
To Top
|