Mason Mod_Perl2.0 Apache 2.0 Fedora Core 1 AMD64 - HOW I DID IT! -

dave_at_subcreations.com
Date: 02/23/05

  • Next message: Thomas Malt: "Re: Compare huge XML Files"
    Date: 23 Feb 2005 14:19:15 -0800
    
    

    Here's how I got Mason to work with Apache 2.0

    In short,

    1. get Mason

    2. get libapreq2-2.04-dev

    3. get mod_perl-2.0-current.tar.gz

    I am using Fedora Core 1 AMD64

    I got Mason at CPAN and installed it using:

    perl -MCPAN -e shell install HTML:Mason

    Following the instructions from the book, "Embedding Perl in HTML with
    MASON" by Dave Rolsky & Ken Williams, The first test using the
    following Perl script in a mod_perl directory worked fine.

    #! /usr/bin/perl

    #handshake.pl
    use strict;
    use HTML::Mason;
    my $interp = HTML::Mason::Interp->new();
    my $comp = $interp->make_component(comp_source => <<'END');
     Greetings, <% ("Earthlings", "Martians")[rand 2] %>
    END
        $interp->exec($comp);
    #End of Script

    This printed the random message intended when executed from the shell
    and didn't print anything when executed in the browser.
    /var/log/httpd/error_log explains why.

    #/var/log/httpd/error_log
    -snip
    [Wed Feb 23 09:43:58 2005] [error] [client 192.168.0.101] malformed
    header from script. Bad header= Greetings, Martians: handshake.pl
    [Wed Feb 23 09:43:58 2005] [warn] /perl/handshake.pl did not send an
    HTTP header
    -endsnip

    The test just hadn't printed the header, but otherwise everything was
    fine.

    Before the second test, it was necessary to reconfigure httpd.conf.

    This consisted of adding the following:

    #/etc/httpd/conf/httpd.conf
    -snip

    PerlModule HTML::Mason::ApacheHandler
    Alias /m /var/www/html/mason/
    <Directory /var/www/html/mason>
            SetHandler perl-script
            PerlHandler HTML::Mason::ApacheHandler
    </Directory>
    -endsnip

    Apache wouldn't start.

    There were a number of problems because I am using Apache 2.0.
    The first was that the system couldn't find the module:
     "Can't locate Apache/Request.pm"

    Apache 2.0 doesn't seem to come with this library.

    Fortunately, there is a new version of libreq (libapreq2-2.04-dev)
    available from CPAN that solves this problem.

    I downloaded the targz and ran the Makefile.pl only to find that I
    needed to upgrade mod_perl.

    So I downloaded the latest mod_perl (mod_perl-2.0-current.tar.gz) and
    ran the Makefile.PL, make and make install.

       This broke the old mod_perl-1.xx configuration in httpd.conf
       The fix is easy. Just change any occurrences of "PerlHandler" to
    "PerlResponseHandler".

    FOR EXAMPLE:
    CHANGE:
    #httpd.conf
    -snip
    Alias /perl /var/www/perl/
    <Directory /var/www/perl>
            SetHandler perl-script
            PerlHandler ModPerl::Registry
            PerlSendHeader on
            Options ExecCGI
    </Directory>
    -endsnip

    TO

    #httpd.conf
    -snip
    Alias /perl /var/www/perl/
    <Directory /var/www/perl>
            SetHandler perl-script
            PerlResponseHandler ModPerl::Registry
            PerlSendHeader on
            Options ExecCGI
    </Directory>

    #endsnip

    Note: This change included changing the "PerlHandler" to
    "PerlResponseHandler" in the configuration script described in the
    Mason Book that I included at the beginning of this post.

    So, Great! Apache is working again. Then I again executed the the
    Makefile.PL for
    libapreq2-2.04-dev and the make and make install.

    Apache still wouldn't start and there was a different error now. Apache
    reported a syntax error caused when it got to the following line in
    httpd.conf:

    #httpd.conf
    -snip
    LoadModule apreq_module /usr/lib64/httpd/modules/mod_apreq.so
    -endsnip

    The error was reported in the status window in
    System-Settings->Server-Settings->Services when I used the Services
    Utility to restart Apache. It said it couldn't find the file,
    "libapreq2.so.2".

    It turned out out that when libapreq2-2.04-dev was installing it put
    libapreq2.so.2 in /usr/lib instead of /usr/lib64. I thought it was
    strange because it put all the other library files in /usr/lib64.

    One other problem I had with libraries was that I needed to move all
    Mason Perl modules into the path.

    >>From my experience with running AMD64, most of the problems I have
    installing software are related to certain library files not ending up
    in lib64.

    I then continued with the next test.

    This test consisted of putting the following in the file called
    handshake.html.

    <!-- handshake.html (Entire file) -->

    Greetings, <% ("Earthlings", "Martians")[rand 2] %>

    <!-- END OF handshake.html -->

    I originally tried creating a "mason" directory (/var/www/mason) that
    was not in the document tree (just like I do with my Perl scripts in
    the /var/www/perl directory) and using an Alias in httpd.conf but it it
    wouldn't work and HTML-Mason-1.28/htdocs/Admin.html made it clear that
    this will always be the case.

    I wound up putting handshake.html in another directory that is in the
    document tree and the page worked as expected.

    It took longer than I expected and I haven't tried anything else yet. I
    still think I'm going to have to install Apache 1.3 for some other
    reasons though.

    Good Luck!


  • Next message: Thomas Malt: "Re: Compare huge XML Files"

    Relevant Pages

    • mod_perl
      ... The script prompts, suggesting version 1 two or three times. ... ppm install failed: The PPD does not provide code to install for ... 256 at mpinstall line 242. ... I noticed that Apache 2.2.9 was not listed. ...
      (comp.lang.perl.misc)
    • How to substitute a variable containing a directory path into Apache httpd.conf file????
      ... I am trying to create a installation script for our product at work. ... The script involves prompting the user for the pathname of Apache (and ... ms-dos variable containing the install path entitled %APACHE_HOME%. ... path of Apache (eg. C:/Program Files/Apache/Apache2). ...
      (comp.lang.perl.misc)
    • Help with SYS V init scripts and rc.d
      ... I have recently set up a RedHat 9 server to server our mail. ... Not all programs automatically install a rc script. ... Apache 2 come with scripts like apachectl which looks like the ...
      (alt.linux)
    • [SLE] Install mod_perl statically?
      ... I have SuSE 8.1 installed running the version of Apache that came with it (including any ... I need to install the Mason module for a project I will be working on. ...
      (SuSE)
    • Re: [Info-ingres] ingres extension, php.5.1.1, fedora core II, ingres R3, apache 1.3.34
      ... >> If I start apache the script: ... > script so that things get set properly. ... also add the ingres.so to the extensions configuration ... > the file and install it for you. ...
      (comp.databases.ingres)