mod_perl on Solaris
This guide is an extension of the general
TWiki on Solaris Cookbook. As such it uses the same assumptions, e.g. TWiki 4.x, Solaris 10, directory structure as described in the cookbook, Apache 2.0 rather than 1.3, etc.
The guide follows closely the general
TWiki mod_perl on Unix instructions which is where to look if you want to know
why, instead of just
how.
Solaris 10 comes pre-installed with Apache 2 that has mod_perl build into it. Therefore there is very little work to do to get mod_perl working with your TWiki installation if you are on Solaris 10.
It is crucially important to use a fairly recent version of Solaris 10. In the first versions of Solaris 10 there was a
bug
that meant that the mod_perl.so file was missing. This guide is tested on Solaris 10 6/06.
Loading mod_perl into Apache
Add the following line to your httpd.conf (/etc/apache2/http.conf if you are following the Cookbook) to the section of the file that has lots of "LoadModule" statements:
LoadModule perl_module libexec/mod_perl.so
Now restart the Apache Web Server (as root):
-
svcadm disable apache2
-
svcadm enable apache2
- Check
/var/svc/log/network-http:apache2.log and /var/apache2/logs/error_log for errors. In the error_log file you should see something like this:
Apache/2.0.55 (Unix) DAV/2 mod_perl/2.0.0 Perl/v5.8.4 configured -- resuming normal operations
which indicates success.
Enabling mod_perl on TWiki
Creating the mod_perl startup file
Go to your
/apps/twiki-root/twiki/tools directory and create a file named
mod_perl_startup.pl with this content:
#!/usr/bin/perl -w
#
$ENV{MOD_PERL} =~ /mod_perl/ or die "mod_perl_startup called, but mod_perl not used!";
use lib qw( /apps/twiki-root/twiki/bin );
require 'setlib.cfg';
1;
Make sure the file is readable the by Apache Web Server user (likely to be
webservd if you are following the Cookbook.). Execute something like this depending on which user you use:
chown webservd:webservd /apps/twiki-root/twiki/tools/mod_perl_startup.pl
Adding mod_perl directives to Apache config
If you are following the Cookbook then you have a TWiki section in your httpd.conf file. Amend this section as follows:
# ****************************************************************************
#
# twiki
#
# ****************************************************************************
# mod_perl settings
PerlRequire /apps/twiki-root/twiki/tools/mod_perl_startup.pl
# Turn on taint checking
PerlSwitches -T
...
...
<Directory "/apps/twiki-root/twiki/bin">
...
...
# mod_perl settings
# This matches all lower-case file names, except
# those starting with "configure"
<FilesMatch "^(?!configure)[a-z.]+$">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlSendHeader On
PerlOptions +ParseHeaders
</FilesMatch>
</Directory>
...
...
# end of TWiki setup
Apache will now use mod_perl on the TWiki bin directory but not on other directories.
Now restart the Apache Web Server (as root):
-
svcadm disable apache2
-
svcadm enable apache2
- Check
/var/svc/log/network-http:apache2.log and /var/apache2/logs/error_log for errors.
--
Contributors: Lars Bruun-Hansen - 24 Sep 2006
Discussion