Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: rexec from a cgi vs cmdline

by dataDrone (Acolyte)
on Aug 18, 2001 at 04:58 UTC ( [id://105855]=note: print w/replies, xml ) Need Help??


in reply to rexec from a cgi vs cmdline

Ok, some clarification. I realize the meaning of the 'not in @INC' error which is why i phrased the question "Why does this work from my shell and not when it's triggered by apache" which is of course running as user nobody. Does perl use the calling users $PATH variable to go looking for modules? I'm fairly certain that i installed the modules (as root) using the regular process without any errors. Shouldn't 'nobody' be able to use them?

Replies are listed 'Best First'.
Re: Re: rexec from a cgi vs cmdline
by Trimbach (Curate) on Aug 18, 2001 at 05:48 UTC
    I just had a similar problem myself and found out the problem was linked to two installations of Perl on the same machine, in different directories, with different @INC. The @INC from the command line and the @INC from the CGI were different, and voila. The key is to go to /usr/bin/ (or wherever your main installation is) and do a ./perl -MCPAN -e shell to make sure the modules are installed in the proper @INC. (Of course, you could always just move the modules around manually, but I prefer the easy way. :-D)

    Gary Blackburn
    Trained Killer

      Ok, Last night i printed out the @INC's from a cgi triggered script and from root's command line and found them to be identical. I then searched through the @INC paths and found the Rexec.pm nodule and checked it's permissions. It is world readable. I didn't (yet) check all the directories leading up to that but will as soon as i get a chance to telnet (SSH) into work (the box in question). In the mean time i'll try the whole shebang on the laptop (which has a very similar install of Linux) and see if it works or not. Thanks for the efforts, Dan.
Re: Re: rexec from a cgi vs cmdline
by perrin (Chancellor) on Aug 18, 2001 at 08:34 UTC
    No, Perl does not use $PATH to find modules. It searches the directories in @INC, which are set up when you compiled Perl. You might have been modifying @INC by setting your PERL5LIB environment variable. You might also have put this module in a directory where user nobody doesn't have permission to see them. Or, it might work from command line because @INC includes your current working directory ("."), and the module you need happens to be there.

    You might just want to print out the contents of @INC from command line and CGI and compare what's in them.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://105855]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-03-29 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found