Solved

How do make CGI errors more verbose?

Posted on 2004-09-23
6
202 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
Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

 

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

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

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

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…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

627 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