This page is a work in progress. It describes step by step what to do to run koha under mod_perl.
Install the mod_perl package from your Linux distribution.
# aptitude install libapache2-mod-perl2
# urpmi apache-mod_perl
# zypper install apache2-mod_perl
The optimal solution, in terms of performance, should be to use ModPerl::Registry as response handler. A lot of work is needed to be done in order to run Koha in this configuration. This changes are expected for Koha v3.4. Koha SHOULD be run safely in with mod_perl until that, using ModPerl::PerlRunPrefork.
Modify your virtual host to explain how handling perl scripts.
#intranet Listen 8079 <VirtualHost localhost:8079> ServerAdmin antoine@koha-fr.org DocumentRoot /koha/rel_3_0 ScriptAlias /cgi-bin/koha "/koha/rel_3_0" ServerName localhost ErrorLog "/var/log/apache2/rel_3_0-error.log" Redirect permanent index.html http://localhost:8079/cgi-bin/koha/mainpage.pl SetEnv PERL5LIB "/koha/rel_3_0" SetEnv KOHA_CONF "/koha/conf/rel_3_0.xml" </VirtualHost>
by this
#intranet Listen 8079 <VirtualHost localhost:8079> ServerAdmin antoine@koha-fr.org DocumentRoot /koha/rel_3_0 ScriptAlias /cgi-bin/koha "/koha/rel_3_0" ServerName localhost ErrorLog "/var/log/apache2/rel_3_0-error.log" Redirect permanent index.html http://localhost:8079/cgi-bin/koha/mainpage.pl SetEnv KOHA_CONF "/koha/conf/rel_3_0.xml" # mod_perl : SetHandler perl-script PerlResponseHandler ModPerl::PerlRunPrefork PerlOptions +ParseHeaders Options +ExecCGI </VirtualHost>
It is better, imho, because it just explain that ALL .pl (in every VirtualHost) are for mod_perl. And nothing more. Under my Mandriva, I (Paul) had some problems with mod_perl trying to compile & execute css, that are, with cvs Koha, in a subdirectory of the main intranet scripts. Add in apache config file :
<Files *.pl> SetHandler perl-script PerlResponseHandler ModPerl::PerlRunPrefork PerlOptions +ParseHeaders PerlSendHeader On Options +ExecCGI </Files>
#!/usr/bin/perl use strict; use warnings; use lib qw(/koha/rel_3_0); # this line fixe PERL5LIB ! # you can add here what you want. # see perl.apache.org for more details. 1; # don't forget to add it.
PerlRequire /path/to/startup.pl
And that should be ok !
Note
To know if the you are running your perl script under mod_perl, there is a special environnement variable
$ENV{MOD_PERL} or die "Execution without mod_perl !";
When running mod_perl on a developer computer you will face problems : when you modify a .pm, it seems that mod_perl misses the change, and still uses the pre-compiled version of the .pl that uses the modified .pm. Thus, the modifs are not visible.
The best solution (unless there is a way to change this behaviour) is to remove mod_perl for developers