How can I build and use mod_perl with my vFabric Web Server installation?
search cancel

How can I build and use mod_perl with my vFabric Web Server installation?

book

Article ID: 293940

calendar_today

Updated On:

Products

Pivotal Web Server

Issue/Introduction

While mod_fcgid can be used for a Perl CGI application, mod_perl offers the ability to access and control various phases of the Apache server and request lifecycles. This article discusses how to build and use mod_perl associated with the system Perl installation.

Resolution

To begin with, the mod_perl source should be downloaded and the archive file expanded. mod_perl is available at http://perl.apache.org/download. In the top-level mod_perl directory, mod_perl can then be built as shown below. The vFabric Web Server Development Files should also be downloaded and installed. The vFabric Web Server httpd apxs script should be modified, if necessary, to point to the system perl with its shebang line (i.e., #!/usr/bin/perl -w).

Note: $VFWS_HOME should be set to, or replaced with, the path of your vFabric Web Server installation's top-level directory.

$ perl Makefile.PL MP_APXS=$VFWS_HOME/httpd-2.2/bin/apxs
$ make
$ make test
$ sudo make install


This should result in mod_perl.so being created in the $VFWS_HOME/httpd-2.2/modules directory. To use mod_perl, the following should be added to the vFabric Web Server instance's httpd.conf:

LoadModule perl_module          "$VFWS_HOME/httpd-2.2/modules/mod_perl.so"
<IfModule mod_perl.c>
    PerlRequire "$VFWS_HOME/<Instance Name>/conf/startup-mod_perl-2.0.5.pl"
    PerlModule Apache2::compat
</IfModule>


Additionally, a mod_perl startup file as referenced by the "PerlRequire" directive above should be created. 

After making these changes, the vFabric Web Server instance should start with  mod_perl.  This can be verified with the startup message in the vFabric Web Server instance's error log:

[Thu Dec 06 16:16:45 2012] [notice] Apache/2.2.23 (Unix) vFabric/5.2.0 vFabricLicense/5.2.0 mod_ssl/2.2.23 OpenSSL/1.0.1c-fips DAV/2 mod_bmx/0.9.4 mod_perl/2.0.7 Perl/v5.8.8 configured -- resuming normal operations

 

Additional Information

http://perl.apache.org/

On some systems, the following warning may occur while building the make file (perl Makefile.PL ...):
************* WARNING *************

Your Perl is configured to link against libgdbm, but libgdbm.so was not found.
You could just symlink it to /usr/lib/libgdbm.so.2.0.0

To address this, simply install the gdbm-devel package (i.e., yum install gdbm-devel).

Another problem seen during the "make" phase is:
/usr/bin/ld: cannot find -luuid
collect2: ld returned 1 exit status
make[3]: *** [../../../blib/arch/auto/APR/APR.so] Error 1
make[3]: Leaving directory `/home/phil/mod_perl-2.0.5/xs/APR/APR'
make[2]: *** [subdirs] Error 2
make[2]: Leaving directory `/home/phil/mod_perl-2.0.5/xs/APR'
make[1]: *** [subdirs] Error 2
make[1]: Leaving directory `/home/phil/mod_perl-2.0.5/xs'
make: *** [subdirs] Error 2

This is due to the libuuid.so link not existing. In my case, the /lib or /lib64 directory contains the shared library libuuid.so.1.2 and the link libuuid.so.1 pointing to this library. To resolve this issue, create the symbolic link libuuid.so pointing to the same shared library in this directory (i.e., ln -s libuuid.so.1.2 libuuid.so).