Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Mod_perl in the httpd.conf file with virtual hosts

Quote Reply
Mod_perl in the httpd.conf file with virtual hosts
I have installed mod_perl on my server and I have successfully been able to load the http://www.mydomain.com/perl-status file, which should mean that mod_perl is up and running, if I'm not mistaken. This on the main domain and when I try it on a virtual host it also works. However whe I set up the below for a virtual host, outside the virtual host code in the main part of the httpd.conf file it doesn't seem to work.

I followed the indications to have :
1) <Location /url/to/gmail>
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
</Location>
in the httpd.conf file

2) Creating a startup file for perl with :
#!/usr/bin/perl5

$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";

use lib '/url/to/gmail/admin';

use GMail::mod_perl;

3) Add reference to this file in the httpd.conf file with a PerlRequire command :

PerlRequire /path/to/startup.pl

However I just get Internal Server Errors.

By the way why isn't it possible to have this type of code in the httpd.conf file :

PerlRequire /home/www/init.pl

<Directory /home/www/docs>
DirectoryIndex login
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Directory>

Would it be possible to have :
use lib qw( /url/to/gmail/admin )
this being the directory where the GMail::mod_perl file is, in the start file ?

Can anybody help me on this one ?

Jag
Significant Media
Quote Reply
Re: [Jag] Mod_perl in the httpd.conf file with virtual hosts In reply to
Hi,

When you say Internal server error, what does it say in the error log?

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Mod_perl in the httpd.conf file with virtual hosts In reply to
Hi,
I have tried changing the startup file and I have found out that the version of mod_perl that I have checks out a set of different locations for appropriate modules to load (it seems to in any case). Thus I just put the startup.pl file in my httpd folder and it finds. If I delete it (having included the PerlRequire startup.pl statement in my httpd.conf file) it says it can't find it and if upload it again I get the below internal server error :

Syntax error on line 42 of /usr/local/etc/httpd/conf/httpd.conf: Can't locate Apache/DBI.pm in @INC (@INC contains: /local_path/gtm/admin /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/site_perl /usr/local/lib/site_perl . /usr/local/etc/httpd/ /usr/local/etc/httpd/lib/perl) at /local_path/gtm/admin/GMail/mod_perl.pm line 20. BEGIN failed--compilation aborted at /local_path/gtm/admin/GMail/mod_perl.pm line 20. BEGIN failed--compilation aborted at /usr/local/etc/httpd//startup.pl line 7.
Fix configuration problem and "touch httpd.conf" to restart httpd

where local_path is the path to the Gossamer Threads admin folder

I get the impression that it is an @INC definition problem and that I either need to modify it some how or transfer all the Gossamer Modules into the mod_perl module folder. Obviously I need to modify my @INC configuration that the startup file modifies. As you can see I have tried to do that in the below file but the line :
use lib qw(/usr/local/bin/perl5.00503);
doesn't achieve anything but I'm ot sure this is the right way around things. I have also tried adding :
use lib qw(/usr/local/bin/perl5);
and
use lib qw(/usr/local/bin/perl5.00503);
use lib qw(/usr/local/lib/perl5/5.00503/sun4-solaris);
use lib qw(/usr/local/lib/perl5/5.00503);
but that doesn't change anything either.

Otherwise What do you think of this for the startup.pl file :
>>>>>>>>>>>>>>>>

#!/usr/bin/perl5

$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";

use strict;
use lib qw(/usr/local/bin/perl5.00503);
use lib qw(/local_path/gtm/admin);
use CGI ();
CGI->compile (':all');
use DBI ();
use DBD::mysql ();
use GMail::mod_perl ();
1; # return true

>>>>>>>>>>>>>>>>

where local_path is the path to the Gossamer Threads admin folder.

In the same way if I use :
#!/usr/bin/perl5

$ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";

use strict;
use lib '/local_path/gtm/admin';
use GMail::mod_perl;
1; # return true
I get the same internal server error message.

At the moment I'm a bit stuck for ideas of getting aroud this problem and any help would be welcome.

Thanks, Jag

Significant Media
Quote Reply
Re: [Jag] Mod_perl in the httpd.conf file with virtual hosts In reply to
As you can tell from above it was because I hadn't got Apache::DBI installed. I thought I had it installed.
I have installed the latest version but I still get errors :

Preloading Gossamer Mail scripts into mod_perl:
. . . . . . .
All scripts compiled and loaded ok!

Can't locate object method "trace_msg" via package "DBI" at /usr/local/lib/site_perl/DBI.pm line 351.
END failed--cleanup aborted.
run: Error 0

It looks as if it didn't get installed correctly.
I got an error using the perl5 -MCPAN -e shell command

Anyway it looks as if Gossamer Mail is working OkWink

Jag
Significant Media