INTERNAL SERVER ERROR

INTERNAL SERVER ERROR

am 30.08.2005 07:21:01 von vivek.j.joshi

Hello Friends,
Kindly help.
I am working on an script which is working with our email program of
our company.
Recently some changes were made to the script and it started giving he
nasty " 500 INTERNAL SERVER ERROR".
The Apache error logs give:-
Premature end of script headers.

Now, the script does execute and the email is sent but the webpage
gives the error. Also, this error comes up only sometimes but not
everytime we run the script in identical conditions, say one in three
times. Sometimes when I go back to the previous page and again press
the submit button , it goes properly. All the file permissions are
proper, the /usr/bin/perl -w is right, Content type is correct, I mean
, all the usual answers to the problem are checked and they are fine.

Also, I dont know how to step run the script from a web browser. Also,
I dont know where to look for the bug since it does run properly
SOMETIMES.

Please help.

Regards,
Vivek. J. Joshi.

Re: INTERNAL SERVER ERROR

am 30.08.2005 14:09:55 von Matt Garrish

wrote in message
news:1125379261.090793.109010@g14g2000cwa.googlegroups.com.. .
>
> Also, I dont know how to step run the script from a web browser. Also,
> I dont know where to look for the bug since it does run properly
> SOMETIMES.
>

No one will be able to help you based on vague descriptions of what you have
tried and no code to see what you're doing (which should not be read as an
invitation to post your entire script!). You need to work on discovering
what part of the script is causing the problem. The less effective way would
be to keep dying out at various key spots until you find the problem code. A
better approach, however, would be to run the script from the command line
and find out exactly what is being output. You shouldn't have any problem
doing this if you're using the CGI module; just enter the name=value
parameters as arguments to the script. See the debugging section of the
documentation for more complete information.

Matt

Re: INTERNAL SERVER ERROR

am 01.09.2005 07:08:26 von vivek.j.joshi

Hi Matt,
I posted the message to this group but didnt suscribe to it and
thats why google didnt show me in my groups. I read your message at the
other group. Now I have suscribed to both of them.
I am posting this again for you here. When the scripts are run via
command line, the output is indeterminate because many of the cgi
variables are given to the perl script at run time, and also it gets
executed only if the cookies are correct, i.e. there are modules which
check the cookies.
As suggested to add the line :-
use CGI::Carp qw(fatalsToBrowser);
its already present.
I am flushing the output using:-
select(STDOUT); $| = 1; #autoflush
if (FAXMAIL) { select(FAXMAIL); $| = 1; }
The module which I have added is for adding attachments from the
folders , which dosen't get executed because I dont attach anything.
Its inside an If-condition. The last line in the Apache logs is:-
Premature end of script headers in sm.e
Also, if the syntax was not okay, it would never have got executed but
it does get executed sometimes.