>> Delete No. 18350 article
No. Cgi-Internal server error

등록 2001-01-19 18:16:00 By localhost     조회 2
이름 권한중    

		wowlinux7.0 X-MAS releas 버전을 사용하고 있는데요.
cgi가 실행이 되질 않네요...
퍼미션 조정두 모두 해놓구....
그룹두 마춰주고
httpd.conf파일도 손봐주고 했는데요...
그래도 안되네요...
아래 cgi파일은 flash counter라고 하는 플래쉬로 구현된 카운터 프로그램인데요.
cgi가 동작을 하지않아서 쓰지 못하고 있어요...
다른 분들은 잘 사용하고 게시던데...
쩝....
웹에서 불러들이면 Internal server Error가 나오고요(내용은 아래쪽에...)
error_log를 보면 Premature end of script headers라는 에러가 나오는데요
남들은 잘 쓰는 cgi가 왜 전 쓸수 없는걸까요?
혹 이거 해결해 주실분 있으시면 감사 또 감사하겠습니다...
 ^^리눅서 화이팅...!!
   ************실행시키고자 하는 cgi파일...
 #!/usr/bin/perl
#
 #설정___######################################################################
 $cgi              = "./count.cgi";        #CGI스크립트가 있는 주소
$file             = "./count.txt";        #로그파일이 있는 주소
$cookiename       = 'count';              #쿠키이름(변경가능)
$dday             = 90;                   #쿠키의 기한일
$uselock          = 0;                    #락 사용여부(0=no 1=yes)
 ################################################################################
#
 &lock_open(CNT, "+<$file");
 $cnt = <CNT>;
($total_c,$yesterday_c,$today_c,$lastday) = split(/,/, $cnt);
 $total_c++;
$today_c++;
$your_c = &get_cookie($cookiename) + 1;
#####오늘과 어제의 연월일 취득
$ENV{'TZ'} = 'JST-9';
( $sec, $min, $hour, $day, $mon, $year )      = localtime(time);
($sec2, $min2, $hour2, $day2, $mon2, $year2 ) = localtime(time-24*60*60);
 $mon++;
$year += 1900;
$today = "$year-$mon-$day";
 $mon2++;
$year2 += 1900;
$yesterday = "$year2-$mon2-$day2";
 #####연월일 비교
if ($today ne $lastday) {
      if ($yesterday ne $lastday) {
         $yesterday_c = 0;
     } else {
         $yesterday_c = $today_c;
     }
     $today_c = 1;
     $lastday = $today;
}
 #####6자리수 변환
$total_c     = sprintf("%06d", $total_c);
$today_c     = sprintf("%06d", $today_c);
$yesterday_c = sprintf("%06d", $yesterday_c);
$your_c      = sprintf("%06d", $your_c);
 seek(CNT, 0, 0);
print CNT "$total_c,$yesterday_c,$today_c,$lastday";
 &unlock_close(CNT);
 #####HTTP헤더
print "Content-type: text/plain";
&set_cookie($cookiename);
print "";
print "cgi=$cgi&total=$total_c&yes=$yesterday_c&today=$today_c&you=$your_c&load=
end&";
 exit(0);
 #####파일락 열기
sub lock_open {
        local(*FILE, $name) = @_;
        if (!open(FILE, $name)) {
                print "content-type: text/plain";
                print "$name파일을 열 수 없습니다.";
                exit(0);
                }
        if ($uselock) {
                eval("flock(FILE, 2)");
                if ($@) {
                        print "content-type: text/plain";
                        print "$@이 환경에서는 flock 은 사용할 수 없습니다$usel
ock = 0 으로 해주세요";
                        exit(0);
                }
        }
        seek(FILE, 0, 0);
}
 #####파일락 닫기
sub unlock_close {
        local(*FILE) = @_;
        if ($uselock) {
                eval("flock(FILE, 8)");
                }
        close(FILE);
}
 #####===쿠키처리===#############################################################
###############
 #####쿠키유효기간
sub get_cookie_date {
        $ENV{'TZ'} = 'JST-9';
        my( $csec, $cmin, $chour, $cday, $cmon, $cyear, $cwday )
                = localtime(time + $dday*60*60*24);
        my(@month) = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
        my(@week) = qw(Sun Mon Tue Wed Thu Fri Sat);
        return sprintf("%s, %d-%s-%04d %02d:%02d:%02d GMT",
                                $week[$cwday],$cday,$month[$cmon+1],$cyear+1900,
$chour,$cmin,$csec);
}
 #####쿠키의 출력
sub set_cookie {
        local($cookiename2) = @_;
sub set_cookie {
        local($cookiename2) = @_;
        $cookiedate = &get_cookie_date;
         print "Set-Cookie:$cookiename=$your_c; expires=$cookiedate; ";
}
 #####쿠키의 취득
sub get_cookie {
        local($cookiename1) = @_;
        @pairs = split(/; /, $ENV{'HTTP_COOKIE'});
        foreach $pair (@pairs) {
                ($name, $value) = split(/=/, $pair);
                if ($name eq $cookiename) {
                        return $value;
                }
        }
        return '';
 } 
   ******웹에서 cgi파일 호출시********
 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost 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.    --------------------------------------------------------------------------------
 Apache/1.3.14 Server at localhost.localdomain Port 80
 ******error log *******
[Fri Jan 19 17:55:58 2001] [error] (2)No such file or directory: exec of /var/ww
w/cgi-bin/count.cgi failed
[Fri Jan 19 17:55:58 2001] [error] [client 210.96.232.168] Premature end of scri
pt headers: /var/www/cgi-bin/count.cgi
[Fri Jan 19 17:56:27 2001] [error] (2)No such file or directory: exec of /var/ww
w/cgi-bin/count.cgi failed
[Fri Jan 19 17:56:27 2001] [error] [client 210.96.232.168] Premature end of scri
pt headers: /var/www/cgi-bin/count.cgi--이 곳에 서명을 적어주십시오.
리눅서 화이팅!!
[관리자] 패스워드를 입력 하십시오. 답장이 존재하면 함께 삭제됩니다.[ 목록 | 이전 ]
패스워드:    

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved