Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
08-21-2009, 04:13 PM
|
#1
|
Member
Registered: Jul 2009
Posts: 645
Rep:
|
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.
|
|
|
08-21-2009, 04:17 PM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
please use useful and informative thread titles and not use words like "urgent" which are usually seen as rude within a voluntary community.
|
|
|
08-21-2009, 04:18 PM
|
#3
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep:
|
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.
|
|
|
08-21-2009, 04:26 PM
|
#4
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
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
|
|
|
08-21-2009, 04:39 PM
|
#5
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep:
|
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?
|
|
|
08-21-2009, 04:45 PM
|
#6
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
The command says :-bash: apachectl: command not found
|
|
|
08-21-2009, 04:47 PM
|
#7
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
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:
|
|
|
08-21-2009, 04:49 PM
|
#8
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
I am the only one that had password to the server, and I am 99% sure no one changed anything
|
|
|
08-21-2009, 07:33 PM
|
#9
|
LQ Newbie
Registered: Jun 2009
Posts: 4
Rep:
|
post a copy of your index.cgi so we can take a look
|
|
|
08-21-2009, 08:42 PM
|
#10
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
[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]
|
|
|
08-21-2009, 09:04 PM
|
#11
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
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.
|
|
|
08-22-2009, 05:05 PM
|
#12
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep:
|
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 it should already be in your PATH.
|
|
|
08-22-2009, 09:52 PM
|
#13
|
Member
Registered: Jul 2009
Posts: 645
Original Poster
Rep:
|
what does the command do really?
I logged in as root via ssh. Doest work.
|
|
|
08-22-2009, 10:42 PM
|
#14
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep:
|
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...
|
|
|
08-22-2009, 11:43 PM
|
#15
|
Member
Registered: Oct 2002
Posts: 188
Rep:
|
lol.. apachectl not found... ouch.
|
|
|
All times are GMT -5. The time now is 11:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|