Thanks all for your suggestions regarding earlier post (below):

Am testing out a new web server running SunOS5.8 " and I can't get any of my cgi 
scripts to run.  I  get this error message:
 "Premature end of script headers"
  the cgi scripts worked perfectly on the old server which was running Digital  UNIX.

------------------

Here's a more info, as I've tried several things and still am having no luck.

New web server:
 perl version is 5.005_03 for sun4-solaris
Running Apache
 (not exactly sure which version but I THINK  this is a newer version than other 
machine))

Old web server: 
perl version is 5.004_04 for alpha-dec-osf
Running Apache

file permissions are set to 755 on the cgi script
path to perl is correct
error message has remained the same:
 "Premature end of script headers"


The script is very simple and I'm sure can be written better, but it worked on the 
other web server. it's a simple script that activates the "Go" button from a pull down 
menu on a web page.


Here's the CGI script that won't run, on new web server.


 #!usr/bin/local/perl -w
     2
     3
     4
     5  #------- Start User Configuration ----------------------------
     6  $main = 'xxx.berkeley.edu';
     7  #---End User Configuration -----------------------------------
     8
     9
    10  use CGI;
    11
    12    $cgi = new CGI;
    13
    14    print $cgi->header;  # print this before printing *anything* else!
    15  print "Content-type: text/html\n\n";
    16
    17  &FormInput(*input);
    18
    19  if($input{'goto'} eq "")
    20     {
    21      print ("Location: http://xxx.berkeley.edu/cat/$main\n\n");
    22     }
    23  else
    24      {
    25      print ("Location: http://xxx.berkeley.edu/cat/$input{'goto'}\n\n");
    26      }
   27
    28  exit;
    29  #-------------------------------------------------------------
    30  # FormInput: Function
    31  #-------------------------------------------------------------
    32  sub FormInput
    33  {
    34  local (*qs) = @_ if @_;
    35
    36  if ($ENV{'REQUEST_METHOD'} eq "GET")
    37          {
    38          $qs = $ENV{'QUERY_STRING'};
    39          }
    49          $qs[$i] =~ s/\+/ /g;
    50          $qs[$i] =~ s/%(..)/pack("c",hex($1))/ge;
    51
    52          ($name,$value) = split(/=/,$qs[$i],2);
    53
    54          if($qs{$name} ne "")
    55                  {
    56                  $qs{$name} = "$qs{$name}:$value";
    57                  }
    58          else
    59                  {
    60                  $qs{$name} = $value;
    61                  }
    62          }
    63
    64  return 1;
    65  }



thanks, Pam :(


Reply via email to