Apache/perl package install and testing (e.g. mod-perl and Mason)
Posted by mwarnock on Wed 17 Aug 2005 at 14:11
I would like to install Mason (libhtml-mason-perl) on my plain-vanilla debian stable (Sarge) system. I tried Mason on an old apache-1.3 setup and LOVED it, much nicer than PHP on many fronts. I am an old linux/apache/perl user (formerly redhat), but pretty new with Debian, Apache2, and Mason. I am working my way up several learning curves at once, so please be patient with me.
Please bear in mind that I often administer remotely over ssh (often over a broadband link with significant latency delays) on relatively low-powered machines, so I tend to favor minimalist command-line and text-based tools over curses-, web-, and X-based tools, which can be annoyingly slow for interactive use, require a larger disk/memory footprint, and may introduce security issues.
I have installed apache2, libhtml-mason-perl, libapache2-mod-perl2, and speedy-cgi-perl, all per the Debian package info for Mason. I may not have installed them in the right order, though, as I have pieced together what I needed as time went on (having started with apache 1.3, not apache2, which requires different dependencies). I note for example that I still have an /etc/apache directory, though it has nothing in it, all the apache2 files are in /etc/apache2. Should install order make a difference?
I have created Mason test files to be served by apache2. I have added the documented Mason directives to the appropriate vhost config file to get Mason loaded, as follows:
PerlModule HTML::Mason::ApacheHandler <Directory /home/www/vhosts/sbrx.com/html> SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler </Directory>
Note that I changed the "<Location />" directive to a more specific "<Directory>" command to limit Mason parsing to this particular vhost directory only. According to the docs as I understand them, anything in that directory should now be parsed by Mason. (I'll worry about filename-specific action later.)
Apache2 loads without complaint, but does not parse (just transmits) the Mason code. Obviously, something in the module chain is not loading or parsing the files as it should. I don't have the same problem with PHP, which I assume fits in the apache toolchain in a similar way. Nor did I have this problem with Apache1, though Apache2 is much more SysV-like in its config architecture, with drop-in module directories and such, rather than the big httpd.conf file of apache1, so maybe I'm just missing something, config-wise. I'm not sure where I should be looking for mod_perl, if it isn't in
I suspect mod_perl may not be loaded, so that PerlModule may be ignored, or else something in Mason is not quite right. Any ideas?
I can't find a flag in the apache2 binary (httpd in the apache docs) that lists modules that are loaded dynamically (only precompiled), nor anything in any log files (as far as I can tell, apache only logs to its "errors" and "access" logs, nothing much in /var/log/messages or elsewhere that I know of). I can get a list of vhosts, but that seems to be about all in the way of "what is apache REALLY doing?" info. Asking Apache2 to parse the config files only gives a "Syntax OK" message, which doesn't help much. Am I missing something?
So I have several related questions for you apache/perl gurus familiar with the "Debian Way":
1) How can I know what dynamic apache modules are in fact loaded and active?
2) More specifically, how can I know if mod_perl is working properly, and whether it has loaded Mason (or any other needed Perl module)?
3) Should an "apt-get install libapache2-mod-perl2" have correctly installed, loaded, and configured mod_perl, or is there something more I need to do, and if so, where would I find Debian documentation of such things? For example, server-info needs to be separately enabled to have it load, and other modules might be similar. If you install a module like mod_perl2, does Debian assume you want it loaded by default, or do you have to do something else?
4) Is there any kind of "debug" mode for apache, where you can submit a http request in some form, and have apache either log or otherwise explain exactly what it does in terms of "Location" or "Directory" directives, request-handlers, and similar magic, before it actually serves the request?
5) How best do I manage Apache/Perl modules, and Debian packages? I often find I need an Apache or CPAN module (like php4, mod_perl, DBI, DBD::Pg, or Mason) but I don't know offhand if there is a Debian package, or if so, exactly what it is named. There is a temptation to just install perl modules through CPAN, and of course the perl/apache docs always say "compile your own". This of course leads to "update hell" later. Am I right in concluding that I should almost always use the Debian package (unless I really need some different compile-time option)?
6) Is there anything in Debian packages that does the kind of live internal testing that CPAN modules (usually) do on install, to ensure they are working right?
7) What is the easiest way to find the correct debian name of a package I need, or to search available packages by keyword, so I can readily see what the options are? I'm thinking of a "man -k" analog, but for available debian packages, not installed commands. For example, is there an easy way to search the available package list for anything containing "mason" or "perl" or "DBI (and) perl", especially where case and word order often get munged in package names? You really have to hate searching debian.org (when search works) or googling (or worse yet, in lynx over ssh) for this kind of info which is probably readily available locally after an "apt-get update".
8) I find myself a bit confused by the plethora of package tools: apt-get, dpkg, and countless other command-line tools, not to mention the frontends (aptitude, synaptic, etc) which I find confusing and awkward to use. Maybe I just need more time. Are there some good primers or references out there for the use of the debian package tools, especially in the area of "how do I find, install, and configure the right package, with all appropriate dependencies (should be automatic), recommendations, suggestions, in the right package order, and make sure it all works as it should?"
9) Is there an easy way to reconfigure a package more interactively on a one-off basis if it seems to be broken, perhaps having it re-examine its environment to see if there are some new packages installed that would affect the configuration (e.g. recommended/suggested packages you might have added since install)?
Sorry about the length of the post. Thanks in advance for any pointers. I'm obviously still getting used to Debian, but really like what I have learned so far, and this site has had some great ideas on it.