Premature end of script headers: admin.cgi

Support
spazio
2006-09-16
2013-04-15
  • spazio
    spazio
    2006-09-16

    On a fresh install i've got this when updating databases in the system configuration of the admin  panel. It did the same thing on create database. After looking tru mysql. The database is there with user and table.
    In the apache ssl log, got this line, any idea of what this is caused by?

    [Sat Sep 16 14:32:09 2006] [error] [client ip]DBD::mysql::st fetchrow_arrayref failed: fetch() without execute() at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux/Mysql/Statement.pm line 14., referer: https://server.com/cgi-bin/admin/admin.cgi?do=logout
    [Sat Sep 16 14:32:09 2006] [error] [client ip] Premature end of script headers: admin.cgi, referer: https://server.com/cgi-bin/admin/admin.cgi

     
    • If you are running mysql 5x you will need to use the admin and hosting sql files from the website to build the database structure.  If your not then drop the database and try recreating it.

      http://hostingsoftware.net/admin.txt
      http://hostingsoftware.net/hosting.txt

       
      • on_gnuhh
        on_gnuhh
        2007-05-04

        Hi,

        i setup gnuhh on CentOS 4.4 with perl 5.8.8 and recompiled every gnuhh perl modules.

        Adding a hosting package is ok, but when editing the same package, the fields that show the details become "undefined" instead of what i typed in. Then i check the apache ssl log, it shows

        [Fri May 04 15:52:57 2007] [error] [client 172.16.0.1] DBD::mysql::st fetchrow_arrayref failed: fetch() without execute() at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/Mysql/Statement.pm line 14., referer: https://172.16.0.2/cgi-bin/admin/admin.cgi?do=nav

        any way to fix this ?

         
        • Tim Becker
          Tim Becker
          2007-08-10

          Apparently you can't fetch all the rows of a table twice on the same DB statement handle.  This was happening in mods/config.pl and mods/domain.pl when the form would populate data based on a dropdown selection.  I added a second $query_output variable ($query_output2) using the same $statement and used that on the second while loop. 

          Now it's working and no more fetch() without execute() error.

          Here's what I changed:

          --- config.pl       Wed Jul 19 15:18:47 2006
          +++ config.pl   Fri Aug 10 14:50:48 2007
          @@ -543,6 +543,7 @@
          &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
          $statement=qq(SELECT id,name,storage,transfer,pop,popspace,responder,mysql,subs,price,setup,annual,client,signup FROM packages WHERE name != 'Forward' ORDER BY name ASC);
          $query_output=$db->query($statement);
          +$query_output2=$db->query($statement);
          if($error=$db->errmsg){&Error($error);}
          my($id,$name,$storage,$transfer,$pop,$popspace,$responder,$mysql,$subs,$price,$setup,$annual,$client,$signup);
          &Top;
          @@ -630,7 +631,7 @@
          group[0][12]=new Number(0);\n);
          my($i)=0;
          $query_output->dataseek();
          -while(($id,$name,$storage,$transfer,$pop,$popspace,$responder,$mysql,$subs,$price,$setup,$annual,$client,$signup)=$query_output->fetchrow)
          +while(($id,$name,$storage,$transfer,$pop,$popspace,$responder,$mysql,$subs,$price,$setup,$annual,$client,$signup)=$query_output2->fetchrow)
                  {
                  $i++;
                  print qq(group[$i][1]=new Number($storage);

          --- domain.pl       Wed Jul 19 15:18:47 2006
          +++ domain.pl   Fri Aug 10 14:57:05 2007
          @@ -4,6 +4,7 @@
          if(($Cookies{'level'} ne "1")&&($access{'DM14'} ne "yes")){&Error('Insufficient access for this function');}
          my($db,$statement,$query_output,$error);
          &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
          $statement=qq(SELECT server,domain,package,storage,transfer,pop,popspace,responder,mysql,subs,amount,billing,billdate FROM domain_map WHERE id='$FORM{'id'}' && reseller='0');
          $query_output=$db->query($statement);
          if($error=$db->errmsg){&Error($error);}
          @@ -1940,6 +1941,7 @@
          &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
          $statement=qq(SELECT id,firstname,lastname,email,company,address1,address2,address3,city,state,zip,country,phone,fax FROM user WHERE email like '$FORM{'email'}' ORDER BY email ASC);
          $query_output=$db->query($statement);
          +$query_output2=$db->query($statement);
          if($error=$db->errmsg){&Error($error);}
          my($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax);
          print "content-type:  text/html\n\r\n\r";

          @@ -2039,7 +2041,7 @@
          group[0][13]=new String("");\n);
          $query_output->dataseek();
          $i=0;
          -while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output->fetchrow)
          +while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output2->fetchrow)
                  {
                  $i++;
                  print qq(group[$i][1]=new String("$email");

          @@ -3512,6 +3514,7 @@
          &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
          $statement=qq(SELECT id,firstname,lastname,email,company,address1,address2,address3,city,state,zip,country,phone,fax FROM user WHERE email like '$FORM{'email'}' ORDER BY email ASC);
          $query_output=$db->query($statement);
          +$query_output2=$db->query($statement);
          if($error=$db->errmsg){&Error($error);}
          my($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax);
          print "content-type:  text/html\n\r\n\r";

          @@ -3611,7 +3614,7 @@
          group[0][13]=new String("");\n);
          $query_output->dataseek();
          $i=0;
          -while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output->fetchrow)
          +while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output2->fetchrow)
                  {
                  $i++;
                  print qq(group[$i][1]=new String("$email");

           
          • Tim Becker
            Tim Becker
            2007-08-10

            Opps!!  I missed one in domain.pl.  Here's an updated patch:

            --- domain.pl   Wed Jul 19 15:18:47 2006
            +++ domain.pl   Fri Aug 10 15:12:48 2007
            @@ -4,6 +4,7 @@
            if(($Cookies{'level'} ne "1")&&($access{'DM14'} ne "yes")){&Error('Insufficient access for this function');}
            my($db,$statement,$query_output,$error);
            &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
            +$db->trace(2);
            $statement=qq(SELECT server,domain,package,storage,transfer,pop,popspace,responder,mysql,subs,amount,billing,billdate FROM domain_map WHERE id='$FORM{'id'}' && reseller='0');
            $query_output=$db->query($statement);
            if($error=$db->errmsg){&Error($error);}

            @@ -1940,6 +1941,7 @@
            &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
            $statement=qq(SELECT id,firstname,lastname,email,company,address1,address2,address3,city,state,zip,country,phone,fax FROM user WHERE email like '$FORM{'email'}' ORDER BY email ASC);
            $query_output=$db->query($statement);
            +$query_output2=$db->query($statement);
            if($error=$db->errmsg){&Error($error);}
            my($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax);
            print "content-type:  text/html\n\r\n\r";

            @@ -2037,9 +2039,9 @@
            group[0][11]=new String("");
            group[0][12]=new String("");
            group[0][13]=new String("");\n);
            -$query_output->dataseek();
            +$query_output2->dataseek();
            $i=0;
            -while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output->fetchrow)
            +while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output2->fetchrow)
                    {
                    $i++;
                    print qq(group[$i][1]=new String("$email");

            @@ -3512,6 +3514,7 @@
            &Error("Database connection error") unless $db=Mysql->connect($system{'dbhost'},$system{'dbname'},$system{'dbuser'},$system{'dbpass'});
            $statement=qq(SELECT id,firstname,lastname,email,company,address1,address2,address3,city,state,zip,country,phone,fax FROM user WHERE email like '$FORM{'email'}' ORDER BY email ASC);
            $query_output=$db->query($statement);
            +$query_output2=$db->query($statement);
            if($error=$db->errmsg){&Error($error);}
            my($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax);
            print "content-type:  text/html\n\r\n\r";

            @@ -3611,7 +3614,7 @@
            group[0][13]=new String("");\n);
            $query_output->dataseek();
            $i=0;
            -while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output->fetchrow)
            +while(($id,$firstname,$lastname,$email,$company,$address1,$address2,$address3,$city,$state,$zip,$country,$phone,$fax)=$query_output2->fetchrow)
                    {
                    $i++;
                    print qq(group[$i][1]=new String("$email");

            @@ -3742,6 +3745,7 @@
            if($error=$db->errmsg){&Error($error);}
            $statement=qq(SELECT id,name,storage,transfer,pop,popspace,responder,mysql,subs,price,setup,annual FROM packages WHERE name != 'Forward' ORDER BY name ASC);
            my($query_output2)=$db->query($statement);
            +my($query_output2a)=$db->query($statement);
            if($error=$db->errmsg){&Error($error);}
            $statement=qq(SELECT name,price,annual FROM addon);
            my($query_output3)=$db->query($statement);

            @@ -4026,8 +4030,8 @@
            group2[0][9]=new String("");
            group2[0][10]=new String("");\n);
            $i=0;
            -$query_output2->dataseek();
            -while(($id,$name,$storage,$transfer,$pop,$popspace,$responder,$mysql,$subs,$price,$setup,$annual)=$query_output2->fetchrow)
            +$query_output2a->dataseek();
            +while(($id,$name,$storage,$transfer,$pop,$popspace,$responder,$mysql,$subs,$price,$setup,$annual)=$query_output2a->fetchrow)
                    {
                    $i++;
                    print qq(group2[$i][1]=new Number($storage);

             
    • on_gnuhh
      on_gnuhh
      2007-05-04

      Also i'm using mysql-server-5.0.27-1.el4.centos and create the db using hosting.txt and admin.txt

      any clue ? thx a lot

       
    • on_gnuhh
      on_gnuhh
      2007-05-05

      I digged into the code and commented out line 633,634,654 in /var/www/cgi-bin/admin/mods/config.pl

      633: while(($id,$name,$storage,$transfer,$pop,$popspace,$responder,$mysql,$subs,$price,$setup,$annual,$client,$signup)=$query_output->fetchrow)
      634: {
      654: }

      when i clicked "Edit Package" in GUI, this error is gone:

      [Sat May 05 14:21:31 2007] [error] [client 172.16.0.1] DBD::mysql::st fetchrow_arrayref failed: fetch() without execute() at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/Mysql/Statement.pm line 14., referer: https://172.16.0.2/cgi-bin/admin/admin.cgi?do=nav

      how to get the remaining fixed ?

       
    • Did you define the packages?  Did you create all the necessary tables?  You must use the file http://hostingsoftware.net/admin.txt to create the admin server database on mysql 5x series.  You have to use http://hostingsoftware.net/hosting.txt to create the hosting server database on mysql 5x series.