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

Problems with section

Expand Messages
  • benoit
    Hello. I m trying to build an Apache configuration that makes it possible for all the developpers in my group to work with their own Apache process. For doing
    Message 1 of 5 , Jul 2, 2004
    • 0 Attachment
      Hello.

      I'm trying to build an Apache configuration that makes it possible for
      all the developpers in my group to work with their own Apache process.
      For doing so, I'm using <perl> sections that build the server
      configuration; changing the User/Group, dynamically ajusting the
      DocumentRoot and Port, etc.

      But however I try to do it, I just can't make it work. It's acting the
      same as if the perl sections where not taking in account when starting
      the server. But mod_perl is working, and it's seems to at least try to
      execute the directives : if I start it with debug trace, I got that :

      - - - -8<- - - -
      [bcaron@here apache]$ MOD_PERL_TRACE=all ./bin/httpd -f
      /home/bcaron/apache/conf/httpd.conf -X
      perl_parse args: '/dev/null' ...allocating perl interpreter...ok
      constructing perl interpreter...ok
      loading perl module 'DynaLoader'...ok
      ok
      running perl interpreter...ok
      mod_perl: 0 END blocks encountered during server startup
      loading perl module 'Apache'...loading perl module
      'Apache::Constants::Exports'...ok
      ok
      loading perl module 'Tie::IxHash'...not ok
      perl_section: </VirtualHost>
      perl_section: </Directory>
      perl_section: </Files>
      perl_section: </Directory>
      perl_section: </Files>
      `@DirectoryIndex' directive is ITERATE, (0 elements)
      default: iterating over @DirectoryIndex
      perl_section: </Location>
      `@PerlModule' directive is ITERATE, (0 elements)
      default: iterating over @PerlModule
      perl_section: </Location>

      - - - -8<- - - -

      If I try to start the server with a <perl> section only, it simply does
      not work ; the server try to start on the default port 80 and since it
      needs to work as a normal user, it stops there. I added :

      ServerType "standalone"
      ServerRoot "/home/bcaron/apache"
      Port 9000

      To make it start on the Port 9000 and to make sur it use my local build
      in my $HOME.

      I'm working with mod_perl 1.29 and Apache 1.3.31. I compiled mod_perl
      and Apache like this :

      perl Makefile.PL APACHE_SRC=../apache_1.3.31/src/ DO_HTTPD=1 USE_APACI=1
      EVERYTHING=1 ADD_MODULE=proxy,rewrite APACHE_PREFIX=/home/bcaron/apache
      PERL_TRACE=1 MOD_PERL_PREFIX=/home/bcaron/mod_perl

      Any idea what I'm doing wrong? I once did a configuration that did
      something like it, but the server was started "root" with sudo, and I
      would prefer not to do this now...

      Thanks for any help

      Benoit


      --
      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
    • benoit
      Ok, now I m ashamed. After some more RTFM, I found that there was a missing-closing-parens festival going on in my configuration file... So, for the record
      Message 2 of 5 , Jul 2, 2004
      • 0 Attachment
        Ok, now I'm ashamed.

        After some more RTFM, I found that there was a missing-closing-parens
        festival going on in my configuration file...

        So, for the record and/or those who will find this message some
        debugging day :

        I followed the suggestion of Pratical Mod_perl, p.132 : I've added a a
        #!/usr/bin/perl
        and
        __END__ in my <perl> block.

        Then, I ran my configuration file with regular Perl :

        $ cd [in my apache server root]
        $ perl -cx conf/httpd.conf

        And Perl informed me a bit more about my stupidity.

        Anyway, I would like to mention that this would be really, really great
        if this kind of error would show up somewhere, at least when one is
        running in "Debug-mode" like I did... Is it something that is present in
        mod_perl v2 (from my readings, I would say No)? If not, could it be?

        For everyone that did read my messages, thanks! :)

        benoit wrote:
        > Hello.
        >
        > I'm trying to build an Apache configuration that makes it possible for
        > all the developpers in my group to work with their own Apache process.
        > For doing so, I'm using <perl> sections that build the server
        > configuration; changing the User/Group, dynamically ajusting the
        > DocumentRoot and Port, etc.
        >
        > But however I try to do it, I just can't make it work. It's acting the
        > same as if the perl sections where not taking in account when starting
        > the server. But mod_perl is working, and it's seems to at least try to
        > execute the directives : if I start it with debug trace, I got that :
        >
        > - - - -8<- - - -
        > [bcaron@here apache]$ MOD_PERL_TRACE=all ./bin/httpd -f
        > /home/bcaron/apache/conf/httpd.conf -X
        > perl_parse args: '/dev/null' ...allocating perl interpreter...ok
        > constructing perl interpreter...ok
        > loading perl module 'DynaLoader'...ok
        > ok
        > running perl interpreter...ok
        > mod_perl: 0 END blocks encountered during server startup
        > loading perl module 'Apache'...loading perl module
        > 'Apache::Constants::Exports'...ok
        > ok
        > loading perl module 'Tie::IxHash'...not ok
        > perl_section: </VirtualHost>
        > perl_section: </Directory>
        > perl_section: </Files>
        > perl_section: </Directory>
        > perl_section: </Files>
        > `@DirectoryIndex' directive is ITERATE, (0 elements)
        > default: iterating over @DirectoryIndex
        > perl_section: </Location>
        > `@PerlModule' directive is ITERATE, (0 elements)
        > default: iterating over @PerlModule
        > perl_section: </Location>
        >
        > - - - -8<- - - -
        >
        > If I try to start the server with a <perl> section only, it simply does
        > not work ; the server try to start on the default port 80 and since it
        > needs to work as a normal user, it stops there. I added :
        >
        > ServerType "standalone"
        > ServerRoot "/home/bcaron/apache"
        > Port 9000
        >
        > To make it start on the Port 9000 and to make sur it use my local build
        > in my $HOME.
        >
        > I'm working with mod_perl 1.29 and Apache 1.3.31. I compiled mod_perl
        > and Apache like this :
        >
        > perl Makefile.PL APACHE_SRC=../apache_1.3.31/src/ DO_HTTPD=1 USE_APACI=1
        > EVERYTHING=1 ADD_MODULE=proxy,rewrite APACHE_PREFIX=/home/bcaron/apache
        > PERL_TRACE=1 MOD_PERL_PREFIX=/home/bcaron/mod_perl
        >
        > Any idea what I'm doing wrong? I once did a configuration that did
        > something like it, but the server was started "root" with sudo, and I
        > would prefer not to do this now...
        >
        > Thanks for any help
        >
        > Benoit
        >
        >

        --
        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
        ... From Changes: =item 1.21_03 - March 15, 2000 new variable $Apache::Server::StrictPerlSections, if true, will croak section generates invalid Apache
        Message 3 of 5 , Jul 2, 2004
        • 0 Attachment
          benoit wrote:
          > Ok, now I'm ashamed.
          >
          > After some more RTFM, I found that there was a missing-closing-parens
          > festival going on in my configuration file...
          >
          > So, for the record and/or those who will find this message some
          > debugging day :
          >
          > I followed the suggestion of Pratical Mod_perl, p.132 : I've added a a
          > #!/usr/bin/perl
          > and
          > __END__ in my <perl> block.
          >
          > Then, I ran my configuration file with regular Perl :
          >
          > $ cd [in my apache server root]
          > $ perl -cx conf/httpd.conf
          >
          > And Perl informed me a bit more about my stupidity.

          From Changes:
          =item 1.21_03 - March 15, 2000

          new variable $Apache::Server::StrictPerlSections, if true, will croak
          <Perl> section generates invalid Apache configuration syntax

          Does it do the trick? I'm not sure why it's not documented.

          > Anyway, I would like to mention that this would be really, really great
          > if this kind of error would show up somewhere, at least when one is
          > running in "Debug-mode" like I did... Is it something that is present in
          > mod_perl v2 (from my readings, I would say No)? If not, could it be?

          In mp2 <Perl> sections errors are fatal by default (will be shortly)


          --
          __________________________________________________________________
          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
        • benoit
          ... Where should I put this? I ve tried adding it in my single section, or even in a stand-alone block at the beginning of my httpd.conf, but if I
          Message 4 of 5 , Jul 2, 2004
          • 0 Attachment
            Stas Bekman wrote:
            > From Changes:
            > =item 1.21_03 - March 15, 2000
            >
            > new variable $Apache::Server::StrictPerlSections, if true, will croak
            > <Perl> section generates invalid Apache configuration syntax
            >
            > Does it do the trick? I'm not sure why it's not documented.
            >

            Where should I put this?

            I've tried adding it in my single <perl> section, or even in a
            stand-alone block at the beginning of my httpd.conf, but if I
            intentionnally break my perl code, I come back with the problem I had,
            ie. a silent failing of httpd -X and a "could not bind to port 80" in
            the error_log.

            As for the documentation of this feature, the "Practical mod_perl" book
            (which I love, btw!) says "if you set this variable to a true value
            [snip] then mod_perl will not tolerate invalid Apache configuration
            syntax and will croak if it encounters invalid syntax." So, it should
            croak only if one use un-localized variable name (which it seems to do
            by default). But it's not a "padding" for possible _Perl_ syntax errors.
            Maybe now is the time when I should take my first peak under the hood of
            mod_perl, but I guess that those Perl sections are eval-ed, no? If it's
            the case, the @! could be catch and the error reported.

            >> Anyway, I would like to mention that this would be really, really
            >> great if this kind of error would show up somewhere, at least when one
            >> is running in "Debug-mode" like I did... Is it something that is
            >> present in mod_perl v2 (from my readings, I would say No)? If not,
            >> could it be?
            >
            >
            > In mp2 <Perl> sections errors are fatal by default (will be shortly)
            >
            >

            I'll try my broken configuration under mp2 when I'll find some time, to
            see how it behaves. I have'nt had time to play with it yet ; I'm just
            back in a mod_perl job after nearly 2 years of *gasp* PHP. :P

            --
            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
            ... startup.pl if it s loaded before perl sections or a simple section. ... Thanks :) ... No, no, it should croak on all errors. It s not an equivalent
            Message 5 of 5 , Jul 2, 2004
            • 0 Attachment
              benoit wrote:
              >
              >
              > Stas Bekman wrote:
              > > From Changes:
              >
              >> =item 1.21_03 - March 15, 2000
              >>
              >> new variable $Apache::Server::StrictPerlSections, if true, will croak
              >> <Perl> section generates invalid Apache configuration syntax
              >>
              >> Does it do the trick? I'm not sure why it's not documented.
              >>
              >
              > Where should I put this?

              startup.pl if it's loaded before perl sections or a simple <perl> section.

              > I've tried adding it in my single <perl> section, or even in a
              > stand-alone block at the beginning of my httpd.conf, but if I
              > intentionnally break my perl code, I come back with the problem I had,
              > ie. a silent failing of httpd -X and a "could not bind to port 80" in
              > the error_log.
              >
              > As for the documentation of this feature, the "Practical mod_perl" book
              > (which I love, btw!)

              Thanks :)

              > says "if you set this variable to a true value
              > [snip] then mod_perl will not tolerate invalid Apache configuration
              > syntax and will croak if it encounters invalid syntax." So, it should
              > croak only if one use un-localized variable name (which it seems to do
              > by default).

              No, no, it should croak on all errors. It's not an equivalent of 'use strict'.
              It's just a badly chosen name for this feature. Besides, in mp2 this won't be
              even an option. I totally fail to see why anybody will want to ignore a
              problem in the config file and continue regardless. Those who will want to
              trap the problem can use 'eval {} '.

              > But it's not a "padding" for possible _Perl_ syntax errors.
              > Maybe now is the time when I should take my first peak under the hood of
              > mod_perl, but I guess that those Perl sections are eval-ed, no? If it's
              > the case, the @! could be catch and the error reported.

              right. Enable tracing and you should see if there are any warnings/errors.
              Here is the code which you want to look at src/modules/perl/perl_config.c:

              #define STRICT_PERL_SECTIONS_SV \
              perl_get_sv("Apache::Server::StrictPerlSections", FALSE)

              void perl_handle_command(cmd_parms *cmd, void *config, char *line)
              {
              CHAR_P errmsg;
              SV *sv;

              MP_TRACE_s(fprintf(stderr, "handle_command (%s): ", line));
              if ((errmsg = handle_command(cmd, config, line))) {
              if ((sv = STRICT_PERL_SECTIONS_SV) && SvTRUE(sv)) {
              croak("<Perl>: %s", errmsg);
              }
              else {
              log_printf(cmd->server, "<Perl>: %s", errmsg);
              }
              }

              MP_TRACE_s(fprintf(stderr, "%s\n", errmsg ? errmsg : "OK"));
              }

              >> In mp2 <Perl> sections errors are fatal by default (will be shortly)
              >>
              >>
              >
              > I'll try my broken configuration under mp2 when I'll find some time, to
              > see how it behaves. I have'nt had time to play with it yet ; I'm just
              > back in a mod_perl job after nearly 2 years of *gasp* PHP. :P

              welcome home :)

              --
              __________________________________________________________________
              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
            Your message has been successfully submitted and would be delivered to recipients shortly.