Bug 8566: [SIGNED-OFF] Enable koha-foreach to insert the instancename into commands
[koha_fer] / debian / scripts / koha-create
index 1556051..841ef86 100755 (executable)
@@ -168,6 +168,19 @@ Typically this can be enabled with:
 EOM
         die
     fi
+
+    # Check that the CGI module is installed and enabled
+    # (Apache 2.4 may not have it by default.)
+    if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'cgi_module'; then
+        cat 1>&2 << EOM
+Koha requires mod_cgi to be enabled within Apache in order to run.
+Typically this can be enabled with:
+
+    sudo a2enmod cgi
+EOM
+        die
+    fi
+
 }
 
 set_biblios_indexing_mode()
@@ -619,7 +632,12 @@ fi
 if [ "$op" = create ] || [ "$op" = populate ] || [ "$op" = use ]
 then
     # Reconfigure Apache.
-    a2ensite "$name"
+    if ! {
+        a2ensite "$name" > /dev/null 2>&1 ||
+            a2ensite "${name}.conf" > /dev/null 2>&1
+    }; then
+        echo "Warning: problem enabling $name in Apache" >&2
+    fi
     service apache2 restart
 
     # Start Zebra.