Loading ...
Sorry, an error occurred while loading the content.

PerlRun, nothing but page header

Expand Messages
  • Bram Whillock
    I recently built and got up and running apache 1.3.19 with mod_perl and mod_ssl. I m not receiving any error messages, but I cannot get any output from a test
    Message 1 of 11 , Apr 5, 2004
    • 0 Attachment
      I recently built and got up and running apache 1.3.19 with mod_perl and
      mod_ssl. I'm not receiving any error messages, but I cannot get any
      output from a test page.

      Apache.conf for the directory is as:
      PerlWarn On
      PerlTaintCheck On
      PerlModule Apache::PerlRun

      <Directory "/var/www/beta">
      SetHandler perl-script
      PerlHandler Apache::PerlRun
      Options ExecCGI
      allow from all
      PerlSendHeader On
      </Directory>

      The script I'm trying to run is named modperl.cgi and is as follows:
      #!/usr/bin/perl
      use CGI::Carp qw(fatalsToBrowser);
      use CGI;

      $CGI = new CGI();
      print $CGI->header("text/html");

      print STDOUT "<html><body>Hello</body></html>";

      However, this produces a 0 length page in the browser. If I try and get
      the page with lwp I get.
      [bram@66 bram]$ lwp-request -USex http://66.235.194.176/beta/modperl.cgi
      LWP::UserAgent::new: ()
      LWP::UserAgent::request: ()
      LWP::UserAgent::send_request: GET http://66.235.194.176/beta/modperl.cgi
      LWP::UserAgent::_need_proxy: Not proxied
      LWP::Protocol::http::request: ()
      LWP::UserAgent::request: Simple response: OK
      GET http://66.235.194.176/beta/modperl.cgi
      User-Agent: lwp-request/2.01

      GET http://66.235.194.176/beta/modperl.cgi --> 200 OK
      Connection: close
      Date: Mon, 05 Apr 2004 20:56:39 GMT
      Server: Apache/1.3.19 (Unix) mod_perl/1.25 mod_ssl/2.8.1 OpenSSL/0.9.7d
      Content-Type: text/html; charset=ISO-8859-1
      Client-Date: Mon, 05 Apr 2004 20:56:39 GMT
      Client-Response-Num: 1
      Client-Transfer-Encoding: chunked

      [bram@66 bram]$

      I can change the content-type which I'm producing headers for to foobar
      and the headers that lwp reports change appropriately, however, I still
      get no content returned, and no error messages in the apache error logs
      either. Any ideas? I am totally confused by this.


      --
      Report problems: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
    • Stas Bekman
      ... Any difference if you remove this line? use CGI::Carp qw(fatalsToBrowser); If not, any luck with this script: #!/usr/bin/perl my $r = shift;
      Message 2 of 11 , Apr 5, 2004
      • 0 Attachment
        Bram Whillock wrote:
        > I recently built and got up and running apache 1.3.19 with mod_perl and
        > mod_ssl. I'm not receiving any error messages, but I cannot get any
        > output from a test page.

        Any difference if you remove this line?

        use CGI::Carp qw(fatalsToBrowser);

        If not, any luck with this script:

        #!/usr/bin/perl
        my $r = shift;
        $r->send_http_header("text/html");
        $r->print("<html><body>Hello</body></html>");

        __________________________________________________________________
        Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
        http://stason.org/ mod_perl Guide ---> http://perl.apache.org
        mailto:stas@... http://use.perl.org http://apacheweek.com
        http://modperlbook.org http://apache.org http://ticketmaster.com

        --
        Report problems: http://perl.apache.org/bugs/
        Mail list info: http://perl.apache.org/maillist/modperl.html
        List etiquette: http://perl.apache.org/maillist/email-etiquette.html
      • Bram Whillock
        Getting rid of the fatalsToBrowser does nothing. The second script gives me an error: [Mon Apr 5 14:17:15 2004] [error] PerlRun: `Can t call method
        Message 3 of 11 , Apr 5, 2004
        • 0 Attachment
          Getting rid of the fatalsToBrowser does nothing.

          The second script gives me an error:
          [Mon Apr 5 14:17:15 2004] [error] PerlRun: `Can't call method
          "send_http_header" on an undefined value at /var/www/beta/modperl.cgi
          line 3.

          > -----Original Message-----
          > From: Stas Bekman [mailto:stas@...]
          > Sent: Monday, April 05, 2004 5:15 PM
          > To: Bram Whillock
          > Cc: modperl@...
          > Subject: Re: PerlRun, nothing but page header
          >
          > Bram Whillock wrote:
          > > I recently built and got up and running apache 1.3.19 with mod_perl
          and
          > > mod_ssl. I'm not receiving any error messages, but I cannot get any
          > > output from a test page.
          >
          > Any difference if you remove this line?
          >
          > use CGI::Carp qw(fatalsToBrowser);
          >
          > If not, any luck with this script:
          >
          > #!/usr/bin/perl
          > my $r = shift;
          > $r->send_http_header("text/html");
          > $r->print("<html><body>Hello</body></html>");
          >
          > __________________________________________________________________
          > Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
          > http://stason.org/ mod_perl Guide ---> http://perl.apache.org
          > mailto:stas@... http://use.perl.org http://apacheweek.com
          > http://modperlbook.org http://apache.org http://ticketmaster.com



          --
          Report problems: http://perl.apache.org/bugs/
          Mail list info: http://perl.apache.org/maillist/modperl.html
          List etiquette: http://perl.apache.org/maillist/email-etiquette.html
        • Stas Bekman
          ... Meaning that you aren t running that script under modperl, but as mod_cgi. You configuration is broken then. To confirm, try: #!/usr/bin/perl print
          Message 4 of 11 , Apr 5, 2004
          • 0 Attachment
            Bram Whillock wrote:
            > Getting rid of the fatalsToBrowser does nothing.
            >
            > The second script gives me an error:
            > [Mon Apr 5 14:17:15 2004] [error] PerlRun: `Can't call method
            > "send_http_header" on an undefined value at /var/www/beta/modperl.cgi
            > line 3.

            Meaning that you aren't running that script under modperl, but as mod_cgi. You
            configuration is broken then. To confirm, try:

            #!/usr/bin/perl
            print "content-type: text/plain\n\n";
            print $ENV{MOD_PERL} ? "mod_perl" : "mod_cgi";

            __________________________________________________________________
            Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
            http://stason.org/ mod_perl Guide ---> http://perl.apache.org
            mailto:stas@... http://use.perl.org http://apacheweek.com
            http://modperlbook.org http://apache.org http://ticketmaster.com

            --
            Report problems: http://perl.apache.org/bugs/
            Mail list info: http://perl.apache.org/maillist/modperl.html
            List etiquette: http://perl.apache.org/maillist/email-etiquette.html
          • Perrin Harkins
            ... Sounds like you aren t running under mod_perl then. Try printing the contents of $ENV{ MOD_PERL } to STDERR. If that value is undefined, then there s
            Message 5 of 11 , Apr 5, 2004
            • 0 Attachment
              On Mon, 2004-04-05 at 17:21, Bram Whillock wrote:
              > Getting rid of the fatalsToBrowser does nothing.
              >
              > The second script gives me an error:
              > [Mon Apr 5 14:17:15 2004] [error] PerlRun: `Can't call method
              > "send_http_header" on an undefined value at /var/www/beta/modperl.cgi
              > line 3.

              Sounds like you aren't running under mod_perl then. Try printing the
              contents of $ENV{'MOD_PERL'} to STDERR. If that value is undefined,
              then there's something wrong in your conf file and you are running the
              script as CGI instead.

              - Perrin


              --
              Report problems: http://perl.apache.org/bugs/
              Mail list info: http://perl.apache.org/maillist/modperl.html
              List etiquette: http://perl.apache.org/maillist/email-etiquette.html
            • Bram Whillock
              Apache error log says: mod_perl/1.25 ... /var/www/beta/modperl.cgi ... -- Report problems: http://perl.apache.org/bugs/ Mail list info:
              Message 6 of 11 , Apr 5, 2004
              • 0 Attachment
                Apache error log says:
                mod_perl/1.25

                > -----Original Message-----
                > From: Perrin Harkins [mailto:perrin@...]
                > Sent: Monday, April 05, 2004 5:29 PM
                > To: Bram Whillock
                > Cc: Modperl List
                > Subject: RE: PerlRun, nothing but page header
                >
                > On Mon, 2004-04-05 at 17:21, Bram Whillock wrote:
                > > Getting rid of the fatalsToBrowser does nothing.
                > >
                > > The second script gives me an error:
                > > [Mon Apr 5 14:17:15 2004] [error] PerlRun: `Can't call method
                > > "send_http_header" on an undefined value at
                /var/www/beta/modperl.cgi
                > > line 3.
                >
                > Sounds like you aren't running under mod_perl then. Try printing the
                > contents of $ENV{'MOD_PERL'} to STDERR. If that value is undefined,
                > then there's something wrong in your conf file and you are running the
                > script as CGI instead.
                >
                > - Perrin
                >



                --
                Report problems: http://perl.apache.org/bugs/
                Mail list info: http://perl.apache.org/maillist/modperl.html
                List etiquette: http://perl.apache.org/maillist/email-etiquette.html
              • Stas Bekman
                ... That means nothing, besides having mod_perl present. You need to configure the server to run your script under mod_perl. Assuming that your script is
                Message 7 of 11 , Apr 5, 2004
                • 0 Attachment
                  Bram Whillock wrote:
                  > Apache error log says:
                  > mod_perl/1.25

                  That means nothing, besides having mod_perl present. You need to configure the
                  server to run your script under mod_perl.

                  Assuming that your script is under:/var/www/beta/modperl.cgi, your configuration:

                  PerlWarn On
                  PerlTaintCheck On
                  PerlModule Apache::PerlRun

                  <Directory "/var/www/beta">
                  SetHandler perl-script
                  PerlHandler Apache::PerlRun
                  Options ExecCGI
                  allow from all
                  PerlSendHeader On
                  </Directory>

                  should work, as long as you don't reset it, somewhere later in httpd.conf.
                  e.g. with ScriptAlias directive, which will use mod_cgi to run the script.

                  __________________________________________________________________
                  Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
                  http://stason.org/ mod_perl Guide ---> http://perl.apache.org
                  mailto:stas@... http://use.perl.org http://apacheweek.com
                  http://modperlbook.org http://apache.org http://ticketmaster.com

                  --
                  Report problems: http://perl.apache.org/bugs/
                  Mail list info: http://perl.apache.org/maillist/modperl.html
                  List etiquette: http://perl.apache.org/maillist/email-etiquette.html
                • Bram Whillock
                  I tried changing the PerlHandler to Apache::Registry and modified the script so that it does: my $r = shift; $r- send_http_header( text/plain );
                  Message 8 of 11 , Apr 5, 2004
                  • 0 Attachment
                    I tried changing the PerlHandler to Apache::Registry and modified the
                    script so that it does:
                    my $r = shift;
                    $r->send_http_header("text/plain");
                    $r->print("foo");
                    return OK;

                    Which works fine. But this isn't a good option considering I've got a
                    lot of code that I want to run under PerlRun.

                    Also, I removed the shebang line to confirm that it's not using the
                    shebang line to resolve the perl interpreter.

                    > -----Original Message-----
                    > From: Stas Bekman [mailto:stas@...]
                    > Sent: Monday, April 05, 2004 5:38 PM
                    > To: Bram Whillock
                    > Cc: 'Perrin Harkins'; 'Modperl List'
                    > Subject: Re: PerlRun, nothing but page header
                    >
                    > Bram Whillock wrote:
                    > > Apache error log says:
                    > > mod_perl/1.25
                    >
                    > That means nothing, besides having mod_perl present. You need to
                    configure the
                    > server to run your script under mod_perl.
                    >
                    > Assuming that your script is under:/var/www/beta/modperl.cgi, your
                    > configuration:
                    >
                    > PerlWarn On
                    > PerlTaintCheck On
                    > PerlModule Apache::PerlRun
                    >
                    > <Directory "/var/www/beta">
                    > SetHandler perl-script
                    > PerlHandler Apache::PerlRun
                    > Options ExecCGI
                    > allow from all
                    > PerlSendHeader On
                    > </Directory>
                    >
                    > should work, as long as you don't reset it, somewhere later in
                    httpd.conf.
                    > e.g. with ScriptAlias directive, which will use mod_cgi to run the
                    script.
                    >
                    > __________________________________________________________________
                    > Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
                    > http://stason.org/ mod_perl Guide ---> http://perl.apache.org
                    > mailto:stas@... http://use.perl.org http://apacheweek.com
                    > http://modperlbook.org http://apache.org http://ticketmaster.com



                    --
                    Report problems: http://perl.apache.org/bugs/
                    Mail list info: http://perl.apache.org/maillist/modperl.html
                    List etiquette: http://perl.apache.org/maillist/email-etiquette.html
                  • Drew Taylor
                    Have you tried setting PerlSendHeader? That will automatically send the headers for you. It s very useful for running under Registry. From Writing Apache
                    Message 9 of 11 , Apr 5, 2004
                    • 0 Attachment
                      Have you tried setting PerlSendHeader? That will automatically send the
                      headers for you. It's very useful for running under Registry.

                      From Writing Apache Modules, pg 144
                      > PerlSendHeader On tells mod_perl to intercept anything that looks
                      > like a header line and to automatically turn it into a correctly
                      > formatted HTTP/1.0 header the way that Apache does with CGI scripts.


                      Drew

                      Bram Whillock wrote:

                      > I tried changing the PerlHandler to Apache::Registry and modified the
                      > script so that it does:
                      > my $r = shift;
                      > $r->send_http_header("text/plain");
                      > $r->print("foo");
                      > return OK;
                      >
                      > Which works fine. But this isn't a good option considering I've got a
                      > lot of code that I want to run under PerlRun.
                      >
                      > Also, I removed the shebang line to confirm that it's not using the
                      > shebang line to resolve the perl interpreter.
                      >
                      >
                      >>-----Original Message-----
                      >>From: Stas Bekman [mailto:stas@...]
                      >>Sent: Monday, April 05, 2004 5:38 PM
                      >>To: Bram Whillock
                      >>Cc: 'Perrin Harkins'; 'Modperl List'
                      >>Subject: Re: PerlRun, nothing but page header
                      >>
                      >>Bram Whillock wrote:
                      >>
                      >>>Apache error log says:
                      >>>mod_perl/1.25
                      >>
                      >>That means nothing, besides having mod_perl present. You need to
                      >
                      > configure the
                      >
                      >>server to run your script under mod_perl.
                      >>
                      >>Assuming that your script is under:/var/www/beta/modperl.cgi, your
                      >>configuration:
                      >>
                      >>PerlWarn On
                      >>PerlTaintCheck On
                      >>PerlModule Apache::PerlRun
                      >>
                      >><Directory "/var/www/beta">
                      >> SetHandler perl-script
                      >> PerlHandler Apache::PerlRun
                      >> Options ExecCGI
                      >> allow from all
                      >> PerlSendHeader On
                      >></Directory>
                      >>
                      >>should work, as long as you don't reset it, somewhere later in
                      >
                      > httpd.conf.
                      >
                      >>e.g. with ScriptAlias directive, which will use mod_cgi to run the
                      >
                      > script.
                      >
                      >>__________________________________________________________________
                      >>Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
                      >>http://stason.org/ mod_perl Guide ---> http://perl.apache.org
                      >>mailto:stas@... http://use.perl.org http://apacheweek.com
                      >>http://modperlbook.org http://apache.org http://ticketmaster.com
                      >
                      >
                      >
                      >


                      --
                      ----------------------------------------------------------------
                      Drew Taylor * Web development & consulting
                      Email: drew@... * Site implementation & hosting
                      Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres
                      ----------------------------------------------------------------


                      --
                      Report problems: http://perl.apache.org/bugs/
                      Mail list info: http://perl.apache.org/maillist/modperl.html
                      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
                    • Perrin Harkins
                      ... That same script should run under PerlRun without problems. I notice that your versions of apache and mod_perl are pretty old. Maybe your CGI.pm is old
                      Message 10 of 11 , Apr 5, 2004
                      • 0 Attachment
                        On Mon, 2004-04-05 at 17:45, Bram Whillock wrote:
                        > I tried changing the PerlHandler to Apache::Registry and modified the
                        > script so that it does:
                        > my $r = shift;
                        > $r->send_http_header("text/plain");
                        > $r->print("foo");
                        > return OK;
                        >
                        > Which works fine. But this isn't a good option considering I've got a
                        > lot of code that I want to run under PerlRun.

                        That same script should run under PerlRun without problems.

                        I notice that your versions of apache and mod_perl are pretty old.
                        Maybe your CGI.pm is old too. You should at least update CGI.pm and
                        consider updating mod_perl and apache too.

                        - Perrin


                        --
                        Report problems: http://perl.apache.org/bugs/
                        Mail list info: http://perl.apache.org/maillist/modperl.html
                        List etiquette: http://perl.apache.org/maillist/email-etiquette.html
                      • Bram Whillock
                        Yes, my apache.conf reads: PerlSendHeader On. ... the ... scripts. ... the ... a ... -- Report problems: http://perl.apache.org/bugs/ Mail list info:
                        Message 11 of 11 , Apr 5, 2004
                        • 0 Attachment
                          Yes, my apache.conf reads:
                          PerlSendHeader On.

                          > -----Original Message-----
                          > From: Drew Taylor [mailto:drew@...]
                          > Sent: Monday, April 05, 2004 5:56 PM
                          > To: Bram Whillock
                          > Cc: 'Modperl List'
                          > Subject: Re: PerlRun, nothing but page header
                          >
                          > Have you tried setting PerlSendHeader? That will automatically send
                          the
                          > headers for you. It's very useful for running under Registry.
                          >
                          > From Writing Apache Modules, pg 144
                          > > PerlSendHeader On tells mod_perl to intercept anything that looks
                          > > like a header line and to automatically turn it into a correctly
                          > > formatted HTTP/1.0 header the way that Apache does with CGI
                          scripts.
                          >
                          >
                          > Drew
                          >
                          > Bram Whillock wrote:
                          >
                          > > I tried changing the PerlHandler to Apache::Registry and modified
                          the
                          > > script so that it does:
                          > > my $r = shift;
                          > > $r->send_http_header("text/plain");
                          > > $r->print("foo");
                          > > return OK;
                          > >
                          > > Which works fine. But this isn't a good option considering I've got
                          a
                          > > lot of code that I want to run under PerlRun.
                          > >
                          > > Also, I removed the shebang line to confirm that it's not using the
                          > > shebang line to resolve the perl interpreter.
                          > >
                          > >
                          > >>-----Original Message-----
                          > >>From: Stas Bekman [mailto:stas@...]
                          > >>Sent: Monday, April 05, 2004 5:38 PM
                          > >>To: Bram Whillock
                          > >>Cc: 'Perrin Harkins'; 'Modperl List'
                          > >>Subject: Re: PerlRun, nothing but page header
                          > >>
                          > >>Bram Whillock wrote:
                          > >>
                          > >>>Apache error log says:
                          > >>>mod_perl/1.25
                          > >>
                          > >>That means nothing, besides having mod_perl present. You need to
                          > >
                          > > configure the
                          > >
                          > >>server to run your script under mod_perl.
                          > >>
                          > >>Assuming that your script is under:/var/www/beta/modperl.cgi, your
                          > >>configuration:
                          > >>
                          > >>PerlWarn On
                          > >>PerlTaintCheck On
                          > >>PerlModule Apache::PerlRun
                          > >>
                          > >><Directory "/var/www/beta">
                          > >> SetHandler perl-script
                          > >> PerlHandler Apache::PerlRun
                          > >> Options ExecCGI
                          > >> allow from all
                          > >> PerlSendHeader On
                          > >></Directory>
                          > >>
                          > >>should work, as long as you don't reset it, somewhere later in
                          > >
                          > > httpd.conf.
                          > >
                          > >>e.g. with ScriptAlias directive, which will use mod_cgi to run the
                          > >
                          > > script.
                          > >
                          > >>__________________________________________________________________
                          > >>Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
                          > >>http://stason.org/ mod_perl Guide ---> http://perl.apache.org
                          > >>mailto:stas@... http://use.perl.org http://apacheweek.com
                          > >>http://modperlbook.org http://apache.org http://ticketmaster.com
                          > >
                          > >
                          > >
                          > >
                          >
                          >
                          > --
                          > ----------------------------------------------------------------
                          > Drew Taylor * Web development & consulting
                          > Email: drew@... * Site implementation & hosting
                          > Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres
                          > ----------------------------------------------------------------
                          >



                          --
                          Report problems: http://perl.apache.org/bugs/
                          Mail list info: http://perl.apache.org/maillist/modperl.html
                          List etiquette: http://perl.apache.org/maillist/email-etiquette.html
                        Your message has been successfully submitted and would be delivered to recipients shortly.