Monday, March 22, 2010

Configure Apache for multiple instances of catalyst module in mod_perl

The trick was to:
use virtual hosts
PerlOptions +Parent to create a new interpreter
PerlModule instead of PerlLoadModule which caused apache to crash

NameVirtualHost *:80

<VirtualHost *:80 />
ServerName a.xyz.com
PerlOptions +Parent
PerlSwitches -IC:/mymodulea/lib -IC:/morestuff/lib
PerlModule MyModule
<Location />
SetHandler modperl
PerlResponseHandler MyModule
</Location>
</VirtualHost>

<VirtualHost *:80 />
ServerName b.xyz.com
PerlOptions +Parent
PerlSwitches -IC:/mymoduleb/lib -IC:/morestuff/lib
PerlModule MyModule
<Location />
SetHandler modperl
PerlResponseHandler MyModule
</Location>
</VirtualHost>

Update
Sorry to say I only got this working on Windows since DBD:Pg caused error on CentOS.

No comments: