Solved

How do make CGI errors more verbose?

Posted on 2004-09-23
6
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

 

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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 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