in reply to Trying to use Apache2::Module throws an Apache exception

How have you loaded the module and used the new directive in the Apache conf? And which version of Apache are you using?

  • Comment on Re: Trying to use Apache2::Module throws an Apache exception

Replies are listed 'Best First'.
Re^2: Trying to use Apache2::Module throws an Apache exception
by davehodg (Acolyte) on Sep 07, 2017 at 13:52 UTC
    It's pretty stock RHEL7 running Server version: Apache/2.4.6 (). It appears that running Apache2::Module::add(__PACKAGE__, \@directives); is what triggers it. Other methods from that module are fine. Like:
    # test if an Apache module is loaded if (Apache2::Module::loaded('mod_perl.c')) { warn "mod_perl!"; }
    This is loading in a metric bumload of mod_perl 1.x code which I've brought up to date. Allegedly. I guess I ought to try the example from that page *without* all the legacy.

    Edit: I've taken out all the other code and all I'm trying to do now it load the module to add a directive to httpd.conf. The code in https://github.com/omnigroup/Apache/blob/master/httpd/server/config.c is:
    /* * If this fails some module forgot to call ap_reserve_module_ +slots*. */ ap_assert(total_modules < conf_vector_length);

      Thanks for this extra info. I'd still be interested to see those parts of the Apache configuration where you have

      1. Loaded the module
      2. Used the new directive

      If the problem is with either of those then it should be easy both to spot and to remedy.

        I've created a stripped down httpd.conf and it's definitely the call to ::add that's triggering it:
        my @directives = ( { name => 'JournalsTrans', }, ); Apache2::Module::add(__PACKAGE__, \@directives);
        All httpd.conf needs is:
        PerlRequire Journals::Trans JournalsTrans parm1 parm2
        I should probably file a bug on the Apache2::Module page.