Gossamer Forum
Home : Products : Gossamer Links : Discussions :

new mod_perl questions

Quote Reply
new mod_perl questions
Yeah, I know - loadsa previous threads about mod_perl.

And I've spent a good part of today reading them, and the rackshack forums, and the apache docs ...

But I still have questions I haven't seen answers to, so before I take the plunge:

1) mod_perl is already installed on my server. After following the steps in the readme, do I have to tell LSQL to use mod_perl or does it just "know"?

2) I'm reading about installing a thin and a fat apache server on the one box. That might be technical overkill right now, but does that mean that a single mod_perl server is now deprecated? Is running a fairly large database/low hits dynamic LSQL installation under mod_perl likely to be better or worse on balance? It shares a fairly busy server and I'm looking at this as one of a number of load-reducing steps. In fact, the low hits thing isn't really relevant as the main problem occurs when the site gets hit hard by SE 'bots - so its the ability to keep loads down undre heavy traffic thats the issue.

3) Looking ahead, I'd like to be able to run more than one LSQL site on the same server. Technically (not licencing-wise) - could that be done under mod_perl and would it influence how I set up this first site? I'm probably only really concerned about page.cgi and search.cgi from a load POV. My suspicion is it can't be done - though maybe renaming these progs on a second installation and loading them into mod_perl would be an option?

TIA for any pointers.

[edited to add:]

oh yeah, 2 more qs:

4) the apache directives - they go in the main httpd.conf for the whole server, or in the confs for the specific virtual host/domain?

5) is there any danger that globals I have added could mess up under mod_perl - especially if they are , er, sloppy with regard to declaring variables etc ?

Last edited by:

CrazyGuy: Jun 17, 2004, 12:19 PM
Quote Reply
Re: [CrazyGuy] new mod_perl questions In reply to

I'm sure that someone from GT will answer eventually and may correct me, but here's my thoughts:

1: No you don't have to tell Links - if mod_perl is running it will find it. You can tell if you look at the environment in setup.

2: I ran my site under a single mod_perl server for a time but eventually it couldn't cope. I think that if you can, it is better to get the backend mod_perl server set up as soon as possible as the performance difference is noticeable.

3: Yes, it is possible to run more than one installation.

4: I think either for the whole server or for the virtual host - depends how you are using the server. I think that if you are going to have several domains it is probably better to start with them in the virtual host.

5: If it is just globals, I think you should be OK because the Links scripts will already be using 'use strict' so I don't think that you can write globals without declaring variables. Plugins might be a different issue.

Quote Reply
Re: [afinlr] new mod_perl questions In reply to
Hi Laura

Thanks for that - I've been doing some testing in the meantime and clarified a few things.

I thought there was one mod_perl for the whole server box but see now its per virtual host so you can use it on one or many domains independently. Good news and more flexible than I thought it would be.

2 things I found:

1) don't get DBI.pm and Apache::DBI.pm confused. I had the former but not the latter.
2) startup.pl must have 1; as the last line or the httpd restart will choke, assuming the file did not complete. That's in the apache docs but not the readme.

So it did work and LSQL just found it - unfortunately I use a nph 404 handler rather than mod rewrite rules, so I'll have to rewrite that to work under mod_perl before using it for real. In fact, I'll have to find out if you can even use nph scripts with mod_perl.
Quote Reply
Re: [CrazyGuy] new mod_perl questions In reply to
Not sure if this helps but I just added a error404 template and then use

ErrorDocument 404 /perl/page.cgi?p=error404

in the virtual host. (And similarly for other errors.)

Last edited by:

afinlr: Jun 17, 2004, 4:22 PM
Quote Reply
Re: [afinlr] new mod_perl questions In reply to
I actually use an nph script to achieve what others do with mod_rewrite - which I can never get to do what I want!

So, my ErrorDocument 404 in .htaccess points to this nph script and I have LSQL point to SE-friendly URLs that don't actually exist but get picked up by the 404 handler. I find it much more flexible to be able to lay out a bunch of "if then" actions in a perl script than it is to construct a complex set of rewrite rules ... but I do accept that is probably because I'm carp at regex's.
Quote Reply
Re: [CrazyGuy] new mod_perl questions In reply to
OK, I got this up and running within one virtual host - and my own nph script/404 handler/front end working under mod_perl too. Hip, hip ...

One thing I would appreciate some GT or other expert answer to - because I can't tell without knowing how the scripts/modules are written - is:

If the Links::mod_perl files within one domain are pre-loaded into mod_perl at a server (not virtual host) level, would they then be available to (and work with) multiple LSQL implementations on the same physical box, each within their own virtual host?