LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 08-21-2009, 04:13 PM   #1
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Rep: Reputation: 42
Internal server error (Premature end of cgi script)


I'm running centos, apache 2.2 with cgi script .Server has been fine for months, and all of a sudden today I get this error :

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@usershare.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9 Server at usershare.net Port 80


Nothing changed, unless I was hacked which I doubt.My error logs say,

Fri Aug 21 13:04:35 2009] [error] [client 190.108.166.58] Premature end of script headers: index.cgi

I recompiled apache but nothing!

I'm lost, can any one help me fix this issue plz.

Thank you

Last edited by cbtshare; 08-21-2009 at 04:32 PM.
 
Old 08-21-2009, 04:17 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,344

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
please use useful and informative thread titles and not use words like "urgent" which are usually seen as rude within a voluntary community.
 
Old 08-21-2009, 04:18 PM   #3
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, FreeBSD
Posts: 3,925
Blog Entries: 5

Rep: Reputation: Disabled
Do you have backups of index.cgi? It sounds like it may have been modified (and broken).

-------
Side note: Please do not use thread titles like "urgent help please". That has nothing to do with your problem.
 
Old 08-21-2009, 04:26 PM   #4
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
sorry @ mod, didnt mean to come off as "rude"....., anomie I didnt do backups, the script main files don't change I even copied over a fresh index.cgi
 
Old 08-21-2009, 04:39 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, FreeBSD
Posts: 3,925
Blog Entries: 5

Rep: Reputation: Disabled
Any form of developer/sysadmin change logs or (even better) a HIDS would be very helpful in troubleshooting this problem. Without knowing what someone may have recently changed, it's going to require digging.

Failing all of the above, what does # apachectl -t say at this point?

What other information is available in your access logs and error logs?
 
Old 08-21-2009, 04:45 PM   #6
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
The command says :-bash: apachectl: command not found
 
Old 08-21-2009, 04:47 PM   #7
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
as for my logs , thats all thats filled up in there : [error] [client 190.108.166.58] Premature end of script headers: index.cgi, referer:
 
Old 08-21-2009, 04:49 PM   #8
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
I am the only one that had password to the server, and I am 99% sure no one changed anything
 
Old 08-21-2009, 07:33 PM   #9
ryan_at_werk
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Rep: Reputation: 0
post a copy of your index.cgi so we can take a look
 
Old 08-21-2009, 08:42 PM   #10
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
[code]
#!/usr/local/bin/perl
### ###
use strict;
use CGI::Carp qw(fatalsToBrowser);
use lib '.';
use XFileConfig;
use Session;

$c->{ip_not_allowed}=~s/\./\\./g;
if($c->{ip_not_allowed} && $ENV{REMOTE_ADDR}=~/$c->{ip_not_allowed}/)
{
print"Content-type:text/html\n\n";
print"Your IP was banned by administrator";
exit;
}
my $ses = Session->new();

my $f = $ses->f;
my $db= $ses->db;
my $op = $f->{op};

&CheckAuth() unless $op eq 'login';

if($ENV{HTTP_CGI_AUTHORIZATION} && $ENV{HTTP_CGI_AUTHORIZATION} =~ s/basic\s+//i)
{
&Login(undef,'instant');
print($ses->{cgi_query}->header(-status=>403)),exit unless $ses->{user};
}

Last edited by cbtshare; 08-22-2009 at 03:21 AM. Reason: added [code] tags [/code]
 
Old 08-21-2009, 09:04 PM   #11
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
when I run #perl index.cgi it works.but it wont load in browser

Last edited by cbtshare; 08-21-2009 at 09:49 PM.
 
Old 08-22-2009, 05:05 PM   #12
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, FreeBSD
Posts: 3,925
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by cbtshare
The command says :-bash: apachectl: command not found
Please find the binary and run the command I mentioned as root. If you simply
Code:
su -
it should already be in your PATH.
 
Old 08-22-2009, 09:52 PM   #13
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Original Poster
Rep: Reputation: 42
what does the command do really?

I logged in as root via ssh. Doest work.
 
Old 08-22-2009, 10:42 PM   #14
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, FreeBSD
Posts: 3,925
Blog Entries: 5

Rep: Reputation: Disabled
This is a basic test that you should be aware of going forward. It performs a syntax check on httpd.conf (and any configuration files it includes).

Working example:
Code:
# apachectl -t
Syntax OK
Broken example:
Code:
# apachectl -t
Syntax error on line 6 of /etc/httpd/conf.d/squid.conf:
Invalid command 'ScriptAlias', perhaps misspelled or defined by a module not included in the server configuration
I don't expect it to solve your problem, but I had intended for it to be a quick and easy sanity check...
 
Old 08-22-2009, 11:43 PM   #15
padlamoij
Member
 
Registered: Oct 2002
Location: East Point, GA
Posts: 188

Rep: Reputation: 30
lol.. apachectl not found... ouch.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
boot sector and lilo collapse !!!!! URGENT URGENT URGEN !!!!! frelihm Linux - Software 21 12-02-2009 10:21 AM
how to mv the files...urgent...urgent manojkarthi Programming 2 07-02-2008 02:21 AM
Urgent Question Regarding Urgent Questions! Need Help Now! Crashed_Again LQ Suggestions & Feedback 11 10-17-2007 08:07 PM
Urgent Urgent !!!! Mozilla Keeps All Your Deleted Emails !!!! odin123 Linux - Software 2 01-31-2004 02:22 AM


All times are GMT -5. The time now is 11:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration