Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do make CGI errors more verbose?

Posted on 2004-09-23
6
Medium Priority
?
210 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 500 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
Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

 

Author Comment

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

Accepted Solution

by:
nicholassolutions earned 500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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 …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

718 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