Hi, all

Geoffrey S Young and David Harris created both the RPM and documented the
logic and possible pitfals with installing mod_perl from RPMs. Those of
you that have asked for help regarding RPMs, would you please go thru the
document and see whether it answers your woes, and of course the RPM
itself.

This is imporant to do it now, while things are hot. Take the chance while
Geoffrey and David are ready to help and jump on it - try it send your
comments. (I don't say they wouldn't in the future, you know how it works 
:)

The moment you refine both the RPM and the document, others would have
much easier times with installing mod_perl, becoming and active user,
tester and even developer. So we are all to benefit from this movement
(Please, no flames - RPM is bad, install from scratch -- there is no
reason to scare away new potential users. Just remember that this RPM
would be installed on millions PCs of RH and other Linux users! So it
worth to take the effort and fine tune this section and the RPM.)

Thank you!

Either read the HTML version at:
http://perl.apache.org/guide/install.html#using_RPM_DEB_and_other_package

Or I'll reproduce it here in text:

A word on mod_perl RPM packages

The virtues of RPM packages is the subject of much debate among mod_perl
users. While RPMs do take the pain away from package
installation and maintenance for most applications, the nuances of
mod_perl make RPMs somewhat less than ideal for those just getting
started. The following help and advice is for those new to mod_perl,
Apache, Linux, and RPMs. If you know what you are doing, this is
probably old hat - contributing your past experiences is, as always,
welcome by the community. 

[TOC]


                                      Getting Started

If you are new to mod_perl and are using this Guide and the Eagle book to
help you on your way, it is probably better to grab the latest
Apache and mod_perl sources and compile the sources yourself. Not only
will you find that this is less daunting than you suspect, but it will
probably save you a few headaches down the line for several reasons. 

First, given the pace at which the open source community produces
software, RPMs, especially those found on distribution CDs, are often
several versions out of date. The most recent version will not only be
more stable, but will likely incorporate some new functionality that you
will eventually want to play with. 

It is also unlikely that the file system's layout of an RPM package will
match what you see in either the Eagle book or this Guide. If you are
new to mod_perl, Apache, or both, you will probably want to get familiar
with file system used by the examples given here before trying
something less standard. 

Finally, the RPMs found on a typical distribution CDs use mod_perl build
with Apache's Dynamic Shared Objects (DSO) support. While
mod_perl can be successfully used as a DSO module, it adds a layer of
complexity that you may want to live without for now. 

All that being said, should you still feel that rolling your own mod_perl
enabled Apache server is not likely, here are a few helpful hints... 

[TOC]


                                 Compiling RPM source files

It is possible to compile the source files provided my RPM packages, but
if you are using RPMs to ease mod_perl installation, that is not the
way to do it. Both Apache and mod_perl RPMs are designed to be
install-and-go. If you really want to compile mod_perl to your own
specific needs, your best bet is to get the most recent sources from CPAN. 

[TOC]


                               Mix and Match RPM and source

It is probably not the best idea to use a self-compiled Apache with a
mod_perl RPM (or vice versa). Sticking with one format or the other at
first will result in fewer headaches and more hair. 

[TOC]


                           Installing a single apache+mod_perl RPM

If you use an apache+mod_perl RPM, chances are rpm -i or glint (GUI for
RPM) will have you up and running immediately, no
compilation necessary. If you encounter problems, try downloading from
another mirror site or searching http://rpmfind.net/ for a different
package - there are plenty out there to choose from. 

David Harris has started the efforts to build a better RPM/SRPM mod_perl
packages. You will find them at:
http://www.davideous.com/modperlrpm/distrib/ 

Features of this RPM: 

     Installs mod_perl as an ``add in'' to the RedHat Apache package, but
does not install mod_perl as a DSO and all the problems that
     brings. 

     Includes the four header files required for building libapreq
(Apache::Request) 

     Distributes plain text forms of the pod documentation files that come
with mod_perl. 

     Checks the module magic number on the existing apache package to see
if things are compatible 

Notes on this un-conventional RPM packaging of mod_perl 

by David Harris <[EMAIL PROTECTED]> on Oct 13, 1999 

This package will install the mod_perl library files on your machine along
with the following two Apache files: 

    /usr/lib/apache/mod_include_modperl.so
    /usr/sbin/httpd_modperl


This package does not install a complete apache subtree built with
mod_perl, but rather just the two above files that are different for
mod_perl. This conceptually thinks of mod_perl as a kind of an ``add on''
that we would like to add to the regular apache tree. However, we
are prevented from distributing mod_perl as an actual DSO, because it is
not recommended by the mod_perl developers and various features
must be turned off. So, instead, we distribute a httpd binary with
mod_perl statically linked (httpd_modperl) and the special modified
mod_include.so required for this binary (mod_include_modperl.so). You can
use the exact same configuration files and other DSO modules,
but you just ``enable'' the mod_perl ``add on'' by following the below
directions. 

To enable mod_perl, do the following: 

    (1) Configure /etc/rc.d/init.d/httpd to run httpd_modperl instead of
        httpd by chaning the "daemon" command line.
    (2) Replace mod_include.so with mod_include_modperl.so in the
        module loading section of /etc/httpd/conf/httpd.conf
    (3) Uncomment the "AddModule mod_perl.c" line in
/etc/httpd/conf/httpd.conf


Or run the following command: (and the other version to disable mod_perl) 

    /usr/sbin/modperl-enable on
    /usr/sbin/modperl-enable off


[TOC]


              Compiling libapreq (Apache::Request) with the RH 6.0
mod_perl RPM

The instructions are as follows: 

   1.Install the source RPM for your mod_perl RPM and then do a build
prep, which unpacks the sources. From there, copy four header
     files (mod_perl.h, mod_perl_version.h, mod_perl_xs.h, and mod_PL.h)
to /usr/include/apache. 

       1.Get the SRPM from
somemirror.../redhat-6.0/SRPMS/mod_perl-1.19-2.src.rpm. 

       2.Install the SRPM. (This creates files in /usr/src/redhat/SPECS
and /usr/src/redhat/SOURCES). Run: 

           % rpm -ih mod_perl-1.19-2.src.rpm


       3.Do a "prep" build of the package, which just un-packags the
sources and applies any patches. 

            % rpm -bp /usr/src/redhat/SPECS/mod_perl.spec
            Executing: %prep
            + umask 022
            + cd /usr/src/redhat/BUILD
            + cd /usr/src/redhat/BUILD
            + rm -rf mod_perl-1.19
            + /bin/gzip -dc /usr/src/redhat/SOURCES/mod_perl-1.19.tar.gz
            + tar -xf -
            + STATUS=0
            + [ 0 -ne 0 ]
            + cd mod_perl-1.19
            ++ /usr/bin/id -u
            + [ 0 = 0 ]
            + /bin/chown -Rf root .
            ++ /usr/bin/id -u
            + [ 0 = 0 ]
            + /bin/chgrp -Rf root .
            + /bin/chmod -Rf a+rX,g-w,o-w .
            + echo Patch #0:
            Patch #0:
            + patch -p1 -b --suffix .rh -s
            + exit 0


         NOTE: What you have just done in steps 1.1 through 1.3 was just a
fancy un-packing of the source tree that builds the RPM
         into /usr/src/redhat/BUILD/mod_perl-1.19. You could un-pack the
mod_perl-x.xx.tar.gz file
         somewhere and then do the following steps on that souce tree. But
this is more ``pure'' because I'm grabbing the header files
         from the same tree that built the RPM. But this does not matter
because RedHat is not patching that file. So, it might be better if
         you just tell the person to grab the mod_perl source and unpack
it to get these files.. less fuss and mess. 

       4.Look at the files you will copy: (this is not really a step, but
useful to show) 

            % find /usr/src/redhat/BUILD/mod_perl-1.19 -name '*.h'

/usr/src/redhat/BUILD/mod_perl-1.19/src/modules/perl/mod_perl.h

/usr/src/redhat/BUILD/mod_perl-1.19/src/modules/perl/mod_perl_xs.h

/usr/src/redhat/BUILD/mod_perl-1.19/src/modules/perl/mod_perl_version.h
            /usr/src/redhat/BUILD/mod_perl-1.19/src/modules/perl/perl_PL.h


       5.Copy the files into /usr/include/apache. 

         NOTE: You should not have to do a: 

            mkdir /usr/include/apache


         Because that directory should be created by apache-devel, which I
think you will need to compile libapreq. The machine I did
         this test on just happened not to have the apache-devel package. 

            % mkdir /usr/include/apache
            % cp ` find /usr/src/redhat/BUILD/mod_perl-1.19 -name '*.h' `
              /usr/include/apache


   2.Apply this patch to libapreq:
http://www.davideous.com/modperlrpm/distrib/libapreq-0.31_include.patch 

   3.Follow the libapreq directions as usual: 

        % perl Makefile.PL
        % make && make test && make install


[TOC]


                 Compiling libapreq with mod_perl installed from RPM
(general)

There have been many reports of libapreq - which provides the
Apache::Request module - not working properly with various RPM
packages. It is definitely possible to integrate libapreq with mod_perl
RPMs, it just requires a few additional steps. 

   1.Make certain you have the apache-devel-x.x.x-x.i386.rpm package
installed. 

   2.Install mod_perl-x.xx-x.src.rpm source code package using the
following syntax: 

        % rpm -ih mod_perl-x.xx-x.src.rpm


   3.Prepare the source package using the following syntax: 

        % rpm -bp /usr/src/redhat/SPECS/mod_perl-x.xx-x.spec


   4.Copy the necessary source files to the proper destination by issuing
the following commands: 

        % mkdir /usr/include/apache 


        % cp `find /usr/src/redhat/BUILD/mod_perl-1.19 -name '*.h'` \
          /usr/include/apache


   5.Download the current libapreq module from
CPAN/modules/by-module/Apache/DOUGM/libapreq-x.xx.tar.gz,
     and unwrap it. 

   6.Make the following changes to the Makefile.PL in the Cookie, Request,
and c directories of libapreq-x.xx. Change: 

        'INC' = "-I../c ". $src->inc,


     To: 

        'INC' = "-I../c -I/usr/include/apache",


   7.Add the following line to the Makefile.PL in the libapreq-x.xx
directory. Add: 

        'INC' = "-I../c -I/usr/include/apache",


     Under: 

        'DIR' = [qw(c Request Cookie)],


   8.Run: 

        % perl Makefile.PL
        % make && make test && make install


     and you should be off and running. 

[TOC]


                        Installing separate Apache and mod_perl RPMs

If you are trying to install separate Apache and mod_perl RPMs, like those
provided by RedHat distributions, you may be in for a bit of a
surprise. Installing the Apache RPM will go just fine, and
http://localhost will bring up some type of web page for your viewing
pleasure.
However, installation of the mod_perl RPM, followed by the How can I tell
whether mod_perl is running tests, will show that Apache is not
mod_perl enabled. This is because mod_perl needs to be added as a separate
module using Apache's Dynamic Shared Objects. 

To use mod_perl as a DSO, make the following modifications to your Apache
configuration files: 

    httpd.conf:
    ----------
    LoadModule perl_module modules/libperl.so
    AddModule mod_perl.c


    srm.conf (or httpd.conf in later versions of Apache):
    ----------
    PerlModule Apache::Registry 
    Alias /perl/ /home/httpd/perl/ 
    <Location /perl 
      SetHandler perl-script 
      PerlHandler Apache::Registry 
      PerlSendHeader On 
      Options +ExecCGI
    </Location


After a complete shutdown and startup of the server, mod_perl should be up
and running. 

[TOC]


                                  Testing the mod_perl API

Some people have reported that even when the server responds positively to
the How can I tell whether mod_perl is running tests, the
mod_perl API will not function properly. You may want to run the below
script to verify the availability of the mod_perl API. 

          use strict;
          my $r = shift;
          $r->send_http_header('text/html');
          $r->print("It worked!!!\n");


_______________________________________________________________________
Stas Bekman  mailto:[EMAIL PROTECTED]    www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheaven    http://www.singlesheaven.com

Reply via email to