Solved

How do make CGI errors more verbose?

Posted on 2004-09-23
6
192 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
Comment Utility
use CGI::Carp qw(fatalsToBrowser);
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
What language are you using for your CGI scripts?

0
 

Author Comment

by:bean19
Comment Utility
Perl
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

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

Accepted Solution

by:
nicholassolutions earned 125 total points
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now