Solved

How do make CGI errors more verbose?

Posted on 2004-09-23
6
195 Views
Last Modified: 2013-12-25
I'm trying to set up some CGI scripts..the error it always throws is "500 Internal Server Error"..the error_log in apache isn't much help either.  Is there any way I can make it give some more verbose information on the problems?  Line number would be especially helpful.
0
Comment
Question by:bean19
6 Comments
 
LVL 84

Assisted Solution

by:ozo
ozo earned 125 total points
ID: 12140192
use CGI::Carp qw(fatalsToBrowser);
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12140245
What language are you using for your CGI scripts?

0
 

Author Comment

by:bean19
ID: 12140277
Perl
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

Author Comment

by:bean19
ID: 12152301
I upgraded the point value of this..anyone know ??
0
 
LVL 15

Accepted Solution

by:
nicholassolutions earned 125 total points
ID: 12156422
If you're using perl, ozo's solution is exactly right. This will send any fatal perl error to the browser. Right now, if the script has a parse error, for example, perl issues an error statement, but you never see it on the webpage. When the script fails, your web server sends a 500 error to the browser, but does not have information about why the script failed exactly. With

use CGI::Carp qw(fatalsToBrowser);

at the beginning of the script, all of perl's error messages will be sent to your web browser and you can see what is going wrong (usually these will automatically include line numbers for parse errors).

I should add that there are other reasons, outside of your actual code, that can cause a 500 error. One is if the file permissions are wrong. You file should be chmod'ed to 755 or 711 so that everyone has permission to execute the script.

Another problem that sometimes gets people is if you uploaded the script in binary format rather than ASCII. If you upload it in binary, the perl parser will see it as giberish. Your ftp program should have an option to upload files in ASCII format.

Cheers,
Matt
0
 
LVL 16

Expert Comment

by:xDamox
ID: 12158603
Hi,

have you tryed running your script form command line to check it runs??
that will give you any errors also in the apache error_logs and access_logs
it will normally tell you whats wrong with your script just see if you can find your script name
in the log files
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Script Host failed (Access is denied.) error 6 243
Register AutoHotkey 12 85
Control Number of Log Files -Perl 7 88
remove computer from using logon script 17 39
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to dynamically set the form action using jQuery.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question