You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Noam Solomon <no...@socketnet.com> on 2002/06/17 23:49:36 UTC

custom directives, again...

I sent out a plea for help last week, but probably didn't provide enough information for a quick solution. The problem is that I'm using Apache::OpenIndex (which is similar to Apache::AutoIndex) and have not been able to get the apache server on the production box to detect a custom directive it defines (OpenIndexOptions). I didn't have this problem on my development machine, so I'm baffled as to its origin.

The error looks like this:

  Syntax error on line 274 of /home/build/httpd/server/./conf/httpd.conf:
  Invalid command 'OpenIndexOptions', perhaps mis-spelled or defined by a module not included in the server configuration

The funny thing is that the configtest has no problem with this directive at all -- it only shows up during  regular startup.

On the theory that there was some problem with modules from mixed versions of mod_perl coexisting in the main perl library, I set up a standalone perl distribution and built mod_perl 1.27 using it, with apache 1.3.24.  For the most part, I was building without "USE_DSO", as follows (from makepl_args.mod_perl):

  APACHE_SRC=../apache_1.3.24/src \
  DO_HTTPD=1 \
  EVERYTHING=1 \
  USE_APACI=1 \
  PREFIX=/home/build/httpd \
  APACHE_PREFIX=/home/build/httpd/server \
  APACI_ARGS="--disable-module=autoindex"

Here I have "disable-module=autoindex" because I was trying to see whether disabling it would allow Apache::AutoIndex or Apache::OpenIndex to replace mod_autoindex. (It didn't).

I just tried USE_DSO and got a heinous segmentation fault (Bad free() ignored during global  destruction.) when I tried to load libperl.so (something about free() notworking properly [and suddenly there's a lot less free memory on the machine!]) so I'm shying away from it now...

Here's the perl -V (notice the -Dusemymalloc, another one of my bright ideas...):

  Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
    Platform:
      osname=linux, osvers=2.2.16-22smp, archname=i686-linux
      uname='linux localhost.localdomain 2.2.16-22smp #1 smp tue aug 22 16:39:21 edt 2000 i686 unknown '
      config_args='-Dprefix=/home/build/httpd -Uinstallusrbinperl -DTWO_POT_OPTIMIZE -DPACK_MALLOC -Ubincompat5005 -USOCKS -Dusemymalloc'
      hint=previous, useposix=true, d_sigaction=define
      usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
      useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
      use64bitint=undef use64bitall=undef uselongdouble=undef
    Compiler:
      cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
      optimize='-O4',
      cppflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
      ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.0)', gccosandvers=''
      intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
      d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
      ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
      alignbytes=4, usemymalloc=y, prototype=define
    Linker and Libraries:
      ld='cc', ldflags =' -L/usr/local/lib'
      libpth=/usr/local/lib /lib /usr/lib
      libs=-lnsl -lgdbm -ldl -lm -lc -lcrypt -lutil
      perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
      libc=/lib/libc-2.1.92.so, so=so, useshrplib=false, libperl=libperl.a
    Dynamic Linking:
      dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
      cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


  Characteristics of this binary (from libperl):
    Compile-time options: USE_LARGE_FILES
    Built under linux
    Compiled at Jun 14 2002 15:42:35
    %ENV:
      PERL5LIB="/home/build/httpd/lib/:/home/build/httpd/lib/perl5/5.6.1/i686-linux:/home/build/httpd/lib/perl5/5.6.1:/home/build/httpd/lib/perl5/site_perl/5.6.1/i686-linux:/home/build/httpd/lib/perl5/site_perl/5.6.1:/home/build/httpd/lib/perl5/site_perl"
      PERLLIB="/usr/local/lib/perl5/5.6.0:/usr/local/lib/perl5/site_perl/5.6.0/i586-linux:/usr/local/lib/perl5/site_perl/5.6.0:/usr/local/lib/perl5/site_perl:.:/usr/local/lib/perl5/5.6.0/i686-linux:/usr/local/lib/perl5/5.6.0:/usr/local/lib/perl5/site_perl/5.6.0/i686-linux:/usr/local/lib/perl5/site_perl/5.6.0:/usr/local/lib/perl5/site_perl:."
    @INC:
      /home/build/httpd/lib/
      /home/build/httpd/lib/perl5/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/5.6.1
      /home/build/httpd/lib/perl5/site_perl/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/site_perl/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/site_perl/5.6.1
      /home/build/httpd/lib/perl5/site_perl/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/site_perl/5.6.1
      /home/build/httpd/lib/perl5/site_perl
      /home/build/httpd/lib/perl5/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/5.6.1
      /home/build/httpd/lib/perl5/site_perl/5.6.1/i686-linux
      /home/build/httpd/lib/perl5/site_perl/5.6.1
      /home/build/httpd/lib/perl5/site_perl
      .

Here's the ./bin/httpd -l:

  Compiled-in modules:
    http_core.c
    mod_env.c
    mod_log_config.c
    mod_mime.c
    mod_negotiation.c
    mod_status.c
    mod_include.c
    mod_dir.c
    mod_cgi.c
    mod_asis.c
    mod_imap.c
    mod_actions.c
    mod_userdir.c
    mod_alias.c
    mod_access.c
    mod_auth.c
    mod_setenvif.c
    mod_perl.c

Any advice would be greatly appreciated.  Thanks

Here's some salient bits of the httpd.conf:

  # GLOBAL MOD_PERL CONFIG
  <IfDefine HAVE_PERL>
    AddModule mod_perl.c
    PerlRequire /home/httpd/startup.pl
    PerlFreshRestart On
    etc..
    PerlRequire /home/httpd/mason/handler.pl
  </IfModule>
  # END GLOBAL MOD_PERL CONFIG
And from /home/httpd/startup.pl:

  $ENV{MOD_PERL} or die "not running under mod_perl!";
  use Carp ();
  $SIG{__WARN__} = \&Carp::cluck;
  print STDERR "startup.pl: $ENV{MOD_PERL} apache version = $Apache::VERSION\n";
  use lib qw(/home/build/modperl/mod_perl-1.26/lib);
  use Apache ();
  use Apache::OpenIndex();
  use Apache::AuthCookie();
  1;









Re: custom directives, again...

Posted by darren chamberlain <dl...@users.sourceforge.net>.
* Noam Solomon <no...@socketnet.com> [2002-06-17 17:49]:
> I sent out a plea for help last week, but probably didn't provide
> enough information for a quick solution. The problem is that I'm using
> Apache::OpenIndex (which is similar to Apache::AutoIndex) and have not
> been able to get the apache server on the production box to detect a
> custom directive it defines (OpenIndexOptions). I didn't have this
> problem on my development machine, so I'm baffled as to its origin.

[-- snip --]

> Here's some salient bits of the httpd.conf:
> 
>   # GLOBAL MOD_PERL CONFIG
>   <IfDefine HAVE_PERL>
>     AddModule mod_perl.c
>     PerlRequire /home/httpd/startup.pl
>     PerlFreshRestart On
>     etc..
>     PerlRequire /home/httpd/mason/handler.pl
>   </IfModule>
>   # END GLOBAL MOD_PERL CONFIG

Make sure that you pull in the module using PerlModule, and not from use
in a PerlRequire.  PerlModule does some bootstrapping to make sure that
directives are passed to your module, rather than let Apache try to do
something with them.

(darren)

-- 
Make no laws whatever concerning speech, and speech will be free;
so soon as you make a declaration on paper that speech shall be
free, you will have a hundred lawyers proving that "freedom does
not mean abuse, nor liberty license"; and they will define and
define freedom out of existence.
    -- Voltarine de Cleyre

Re: custom directives, again...

Posted by Noam Solomon <no...@socketnet.com>.
To solve the second problem (Apache::Icon not loading its directives
properly), I ended up commenting out all the "AddModule" statements as well
as the "ClearModuleList" statement in the httpd.conf fiile.  I don't really
know why this fixed the problem, but I suppose it's related to having
statically compiled all the basic modules directly into the httpd binary.
The answer came to me when I belatedly remembered having encountered a
similar problem a couple months ago on my development server, where I had
httpd dynamically loading its binaries, and the problem then turned out to
be that I had some modules loading in the wrong order.

Hope this helps someone somewhere down the line!

----- Original Message -----
From: "Per Einar Ellefsen" <pe...@skynet.be>
To: "Noam Solomon" <no...@socketnet.com>
Cc: "Mod-perl list" <mo...@perl.apache.org>
Sent: Monday, June 17, 2002 6:37 PM
Subject: Re: custom directives, again...


> At 00:25 18.06.2002, Noam Solomon wrote:
> >Thanks -- that got me over one hurdle!  Next one:
> >
> >Syntax error on line 382 of /home/build/httpd/server/./conf/httpd.conf:
> >Invalid command 'AddIconByEncoding', perhaps mis-spelled or defined by a
> >module not included in the server configuration
> >I've replaced the startup.pl call with:
> >
> >   #PerlModule Apache::AutoIndex
> >   PerlModule Apache::OpenIndex
> >   PerlModule Apache::Icon
> >   PerlModule Apache::AuthCookie
> >Switching on AutoIndex versus OpenIndex makes no difference.
> >
> >Any idea what could be going on here?  I just tried reinstalling
> >Apache::Icon, with
> >no improvement.
>
> Sorry, I'm at a loss here.
>
> >
> >Thanks


Re: custom directives, again...

Posted by Per Einar Ellefsen <pe...@skynet.be>.
[Please Cc the list when replying. I can't respond to all questions]

At 00:25 18.06.2002, Noam Solomon wrote:
>Thanks -- that got me over one hurdle!  Next one:
>
>Syntax error on line 382 of /home/build/httpd/server/./conf/httpd.conf:
>Invalid command 'AddIconByEncoding', perhaps mis-spelled or defined by a 
>module not included in the server configuration
>I've replaced the startup.pl call with:
>
>   #PerlModule Apache::AutoIndex
>   PerlModule Apache::OpenIndex
>   PerlModule Apache::Icon
>   PerlModule Apache::AuthCookie
>Switching on AutoIndex versus OpenIndex makes no difference.
>
>Any idea what could be going on here?  I just tried reinstalling 
>Apache::Icon, with
>no improvement.

Sorry, I'm at a loss here.

>
>Thanks
>
>
>
>----- Original Message -----
>From: "Per Einar Ellefsen" <<m...@skynet.be>
>To: "Noam Solomon" <<m...@socketnet.com>
>Cc: <<m...@perl.apache.org>
>Sent: Monday, June 17, 2002 6:02 PM
>Subject: Re: custom directives, again...
>
> > At 23:49 17.06.2002, Noam Solomon wrote:
> > ># GLOBAL MOD_PERL CONFIG
> > ><IfDefine HAVE_PERL>
> > >   AddModule mod_perl.c
> > >   PerlRequire /home/httpd/startup.pl
> > >   PerlFreshRestart On
> > >   etc..
> > >   PerlRequire /home/httpd/mason/handler.pl
> > ></IfModule>
> > ># END GLOBAL MOD_PERL CONFIG
> > >
> > >And from /home/httpd/startup.pl:
> > >
> > >$ENV{MOD_PERL} or die "not running under mod_perl!";
> > >use Carp ();
> > >$SIG{__WARN__} = \&Carp::cluck;
> > >print STDERR "startup.pl: $ENV{MOD_PERL} apache version =
> > >$Apache::VERSION\n";
> > >use lib qw(/home/build/modperl/mod_perl-1.26/lib);
> > >use Apache ();
> > >use Apache::OpenIndex();
> > >use Apache::AuthCookie();
> > >1;
> >
> > I think you *have* to use "PerlModule" to bring in the module defining
> > custom directives, and not use(). And bring it in as early as possible.
> > Lots of magic going on.
> >
> >
> > --
> > Per Einar Ellefsen
> > <ma...@skynet.be>per.einar@skynet.be
> >
> >
> >

-- 
Per Einar Ellefsen
per.einar@skynet.be



Re: custom directives, again...

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>> use Apache::OpenIndex();
>> use Apache::AuthCookie();
>> 1;
> 
> 
> I think you *have* to use "PerlModule" to bring in the module defining 
> custom directives, and not use(). 


yes, you must use PerlModule with custom directives.  this requirement 
changed from 1.25 to 1.26 IIRC.

--Geoff

 



Re: custom directives, again...

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 23:49 17.06.2002, Noam Solomon wrote:
># GLOBAL MOD_PERL CONFIG
><IfDefine HAVE_PERL>
>   AddModule mod_perl.c
>   PerlRequire /home/httpd/startup.pl
>   PerlFreshRestart On
>   etc..
>   PerlRequire /home/httpd/mason/handler.pl
></IfModule>
># END GLOBAL MOD_PERL CONFIG
>
>And from /home/httpd/startup.pl:
>
>$ENV{MOD_PERL} or die "not running under mod_perl!";
>use Carp ();
>$SIG{__WARN__} = \&Carp::cluck;
>print STDERR "startup.pl: $ENV{MOD_PERL} apache version = 
>$Apache::VERSION\n";
>use lib qw(/home/build/modperl/mod_perl-1.26/lib);
>use Apache ();
>use Apache::OpenIndex();
>use Apache::AuthCookie();
>1;

I think you *have* to use "PerlModule" to bring in the module defining 
custom directives, and not use(). And bring it in as early as possible. 
Lots of magic going on.


-- 
Per Einar Ellefsen
per.einar@skynet.be