Problems using RT.pm under a web environment

For a variety of reasons I want users to be able to create Queues via a
web interface.

I have a bit of code which looks like

BEGIN {
  use lib( "/opt/rt3/local/lib", "/opt/rt3/lib");
  eval {
	use RT;
    RT::LoadConfig();
  };
  die $@ if $@;
}
RT::Init();


my $queue   = RT::Queue->new($RT::SystemUser);
my ($status,$msg) = $queue->Create(%conf);

which works fine from the command line but fails dismally from within a
CGI with the error

[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] Couldn’t
require MPC::SoftwareCatalogue::Rt : Can’t locate
/opt/rt3/etc/RT_SiteConfig.pm in @INC (@INC contains: /opt/rt3/local/lib
/opt/rt3/lib
[ … ]
.) at /opt/rt3/lib/RT.pm line 124., referer:
http://software/portfolio/rt
[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] BEGIN
failed–compilation aborted at
/home/software_portfolio/lib//MPC/SoftwareCatalogue/Rt.pm line 14.,
referer: http://software/portfolio/rt
[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] Compilation
failed in require at /var/www/html/portfolio/index.cgi line 29.,
referer: http://software/portfolio/rt
[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] , referer:
http://software/portfolio/rt

I’ve tried fiddling round with the require in /opt/rt3/lib/RT.pm
thinking that maybe it needed the

eval "require $class";

form of require.

I suppose I could add /opt/rt3/etc into my @INC and write my own version
of RT::LoadConfig() which just does a

require RT_SiteConfig;

which may fix it but I want to know if I’m doing anything especially
dumb before I do that.

Cheers

Simon

rorshach and prozac and everything’s groovy

Simon Wistow wrote:

For a variety of reasons I want users to be able to create Queues via a
web interface.

I have a bit of code which looks like
[…]
which works fine from the command line but fails dismally from within a
CGI with the error

[Fri Jul 29 12:04:14 2005] [error] [client 172.16.11.34] Couldn’t
require MPC::SoftwareCatalogue::Rt : Can’t locate
/opt/rt3/etc/RT_SiteConfig.pm in @INC (@INC contains: /opt/rt3/local/lib
/opt/rt3/lib
[ … ]

Check that the web server can read your RT_SiteConfig.pm. It proably has
different access rights and since RT_SiteConfig.pm contains your
database access data, it’s not publically readable.

Rolf

On Fri, Jul 29, 2005 at 04:02:37PM +0200, Rolf Grossmann said:

Check that the web server can read your RT_SiteConfig.pm. It proably has
different access rights and since RT_SiteConfig.pm contains your
database access data, it’s not publically readable.

That loud thunk you heard was my head smacking against the desk. I’d
forgotten that on this machine the webserver was running as a different
user.

I’ll say 6 hail marys and repeat the mantra “check the obvious stuff
before you mail a list”

Simon (feeling very sheepish)