bricoleurs / bricolage

Content management and publishing system
http://www.bricolagecms.org/
111 stars 51 forks source link

mod_apreq "missing from your installation" #53

Closed streaps closed 9 years ago

streaps commented 9 years ago

I have installed apache2, mod_perl and mod_apreq2 on Ubuntu 14.04.

I think inst/htprobe_apache2.pl is looking for mod_apreq, but the module is named mod_apreq2.

bricolage$ make
/usr/bin/perl inst/httpd.pl STANDARD

==> Probing Apache Configuration <==

Extracting configuration data from `/usr/sbin/apache2 -V`.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Reading Apache conf file: /etc/apache2/apache2.conf.
Reading Apache conf file: /etc/apache2/ports.conf.
Extracting static module list from `/usr/sbin/apache2 -l`.
Your Apache supports loadable modules (DSOs).
Found Apache user: www-data
Found Apache group: www-data
Checking for required Apache modules...
###############################################################################

The following Apache modules are required by Bricolage and
are missing from your installation:
    mod_apreq

Please install them or, if they are installed, you may need to enable them in
the mods-enabled directory of your apache2 installation or use a2enmod <module>,
if you have that installed on your operating system.

###############################################################################
Failed to launch apache2 probing script inst/htprobe_apache2.pl: 256
make: *** [apache.db] Error 1
theory commented 9 years ago

It's looking for a module named mod_apreq. Might it be called something else on Ubuntu?

streaps commented 9 years ago

mod_apreq2

theory commented 9 years ago

Would you be so kind as to try again with this patch?

diff --git a/inst/htprobe_apache2.pl b/inst/htprobe_apache2.pl
index bf4228d..20bf122 100644
--- a/inst/htprobe_apache2.pl
+++ b/inst/htprobe_apache2.pl
@@ -258,6 +258,11 @@ sub check_modules {
             next;
         }

+        # On some platforms, apreq is called apreqs.
+        if ($mod eq 'apreq' && exists $AP{static_modules}{"mod_apreq2"}) {
+            next;
+        }
+
         # try DSO
         if ($AP{dso}) {
             # try modules specified in LoadModule
@@ -269,6 +274,16 @@ sub check_modules {
                 $AP{$mod} = 1 if $mod =~ /ssl$/;
                 next MOD;
             }
+
+            # On some platforms, apreq is called apreq2.
+            elsif ($mod eq 'apreq'
+                     and $AP{load_modules}{apreq2_module}
+                     and -e catfile($AP{HTTPD_ROOT},
+                                    $AP{load_modules}{apreq2_module}))
+            {
+                next MOD;
+            }
+
             # On some platforms, "log_config" can actually be loaded via
             # AddModule as "config_log". (note: hopefully they "fixed" that,
             # but I left support for it in)
streaps commented 9 years ago

same error

theory commented 9 years ago

What is the output of httpd -l?

Would you paste in all the LoadModule lines from your configuration file? You can get the path to it with this command: httpd -V | grep SERVER_CONFIG_FILE.

theory commented 9 years ago

This is assuming, of course, that you have only one instance of httpd on your box.

streaps commented 9 years ago
Compiled in modules:
  core.c
  mod_so.c
  mod_watchdog.c
  http_core.c
  mod_log_config.c
  mod_logio.c
  mod_version.c
  mod_unixd.c

and

 -D SERVER_CONFIG_FILE="apache2.conf"
theory commented 9 years ago

So, Bricolage can’t find apreq because Apache thinks that its configuration file is ./apache2.conf. Which is just whack. Is this the Apache built for core Ubuntu, or some third-party build?

streaps commented 9 years ago

It's core Ubuntu apache2 2.4.7-1ubuntu4.1

Is it whack or is Bricolage expecting some specific behaviour / apache2 configuration that is common, but not guaranteed?

theory commented 9 years ago

Sorry, I mis-read the code (it has been a while). What is the output of httpd -V | grep HTTPD_ROOT? Better, just the output of httpd -V so we get the whole thing. You're going to want to know the HTTPD root, where apache2.conf is a file. We will then need to know the contents of that file, specifically, lines with LoadModule in them.

streaps commented 9 years ago

In Ubuntu the modules that are loaded are enabled/configured in /etc/apache2/mods-enabled.

/etc/apache2/apache2.conf:

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

most of the configuration is done in the include files outside of apache2.conf

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#       /etc/apache2/
#       |-- apache2.conf
#       |       `--  ports.conf
#       |-- mods-enabled
#       |       |-- *.load
#       |       `-- *.conf
#       |-- conf-enabled
#       |       `-- *.conf
#       `-- sites-enabled
#               `-- *.conf

$ apache2 -V

Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38
Server's Module Magic Number: 20120211:27
Server loaded:  APR 1.5.1-dev, APR-UTIL 1.5.3
Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"
theory commented 9 years ago

Ah, and IncludeOptional was added in Apache 2.4. Pretty sure 2.2 wasn't even out when we wrote the apache 2 probe code. In any event, I think this patch should fix it. Would you give it a try, please?

diff --git a/inst/htprobe_apache2.pl b/inst/htprobe_apache2.pl
index bf4228d..0a3541c 100644
--- a/inst/htprobe_apache2.pl
+++ b/inst/htprobe_apache2.pl
@@ -109,16 +109,21 @@ sub read_conf {
     # Read in any included configuration files.
     # (note: this is wrong in htprobe_apache.pl, where I left it alone.)
     my $included = '';
-    while ($AP{conf} =~ /^\s*Include\s+(.+)$/gim) {
-        $included .= "\n" . slurp_conf(
-            file_name_is_absolute($1)
-                ? $1
-                : rel2abs($1, $AP{HTTPD_ROOT})
-        );
+    while ($AP{conf} =~ /^\s*Include(?:Optional)?\s+(.+)$/gim) {
+        for my $file ( _incldue_files($1) ) {
+            $included .= "\n" . slurp_conf($file);
+        }
     }
     $AP{conf} .= $included;
 }

+sub _include_files {
+    my $base = shift;
+    $base = rel2abs($base, $AP{HTTPD_ROOT}) unless file_name_is_absolute($base);
+    return $base if -f $base;
+    return glob -d $base ? catfile($base, '*') : $base;
+}
+
 sub slurp_conf {
     my $file = shift;
     my @files = ();
phillipadsmith commented 9 years ago

:+1:

streaps commented 9 years ago
==> Probing Apache Configuration <==

Extracting configuration data from `/usr/sbin/apache2 -V`.
Reading Apache conf file: /etc/apache2/apache2.conf.
Undefined subroutine &main::_incldue_files called at inst/htprobe_apache2.pl line 113.
Failed to launch apache2 probing script inst/htprobe_apache2.pl: 65280
make: *** [apache.db] Error 255

This is the patched htprobe_apache2.pl: http://ge.tt/6stRuyr1/v/0

theory commented 9 years ago

Well, that's because I kant spell. Sory about that. You can either correct the spelling of _include_files or revert the previous patch and apply this one.

diff --git a/inst/htprobe_apache2.pl b/inst/htprobe_apache2.pl
index bf4228d..f376b78 100644
--- a/inst/htprobe_apache2.pl
+++ b/inst/htprobe_apache2.pl
@@ -109,16 +109,21 @@ sub read_conf {
     # Read in any included configuration files.
     # (note: this is wrong in htprobe_apache.pl, where I left it alone.)
     my $included = '';
-    while ($AP{conf} =~ /^\s*Include\s+(.+)$/gim) {
-        $included .= "\n" . slurp_conf(
-            file_name_is_absolute($1)
-                ? $1
-                : rel2abs($1, $AP{HTTPD_ROOT})
-        );
+    while ($AP{conf} =~ /^\s*Include(?:Optional)?\s+(.+)$/gim) {
+        for my $file ( _include_files($1) ) {
+            $included .= "\n" . slurp_conf($file);
+        }
     }
     $AP{conf} .= $included;
 }

+sub _include_files {
+    my $base = shift;
+    $base = rel2abs($base, $AP{HTTPD_ROOT}) unless file_name_is_absolute($base);
+    return $base if -f $base;
+    return glob -d $base ? catfile($base, '*') : $base;
+}
+
 sub slurp_conf {
     my $file = shift;
     my @files = ();
streaps commented 9 years ago

I missed that spelling error (autocorrected by my brain while reading the error message). Now it works :).

FYI, I need to execute source /etc/apache2/envvars before make on Ubuntu.

theory commented 9 years ago

Oh, interesting. What's in that file?

Themroc commented 8 years ago

/etc/apache2/envvars is used by Debian (and derivates like Ubuntu) to set various env vars like APACHE_RUN_USER or APACHE_LOCK_DIR. Without them, apache2ctl gives you this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719280. And of course, one can't source it in /etc/profile or the like, 'cause it also contains unset HOME; export LANG=C m(

theory commented 8 years ago

@Themroc: Should README.Debian be updated? Care to submit a pull request?

Themroc commented 8 years ago

Yes and yes. I'll do it once i have bricolage fully running. Currently, i get a

Forbidden

You don't have permission to access / on this server.
Server unable to read htaccess file, denying access to be safe

Apache/2.4.10 (Debian) mod_apreq2-20090110/2.8.0 mod_perl/2.0.9dev Perl/v5.20.2 Server at spock Port 80

Should i file another bug report on this?

Update: Nevermind, a chgrp -R fixed it. Stupid me!