From elbie at trig.net Fri Apr 2 16:02:20 2004 From: elbie at trig.net (Christopher Calzonetti) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. Message-ID: <20040402220220.GA85369@trig.net> Okay, so I've tried searching through all sorts of places for the answer for this, and have had no success. Maybe somebody on this list knows. I've got a bunch of perl modules installed in a semi-reasonable place, considering my setup, namely OSX, using fink. The modules in question are in /sw/lib/perl5:sw/lib/perl5/darwin And my environment variable PERL5LIB is set up as such. So when I run perl -V, I see all the directories in @INC, as I expect. However, when under apache, my same perl scripts cannot find these extra directories. I fiddled around as best I could, and I wrote a quick little script to help me check. PERL5LIB is set properly, but @INC is nevertheless missing the key directories. All the solutions on the web all seem to refer to mod_perl solutions. Not that I can get it working under mod_perl either, but I'd really like perl under the CGI handler to be able to find the libraries without having to change all my scripts to add a use lib ... command or two or three. Any thoughts? -- Christopher Calzonetti, Technical Lead, Trig.Net Web: http://www.trig.net/ Mail: mailto:chris@trig.net From daniel at coder.com Fri Apr 2 16:39:48 2004 From: daniel at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: <20040402220220.GA85369@trig.net> Message-ID: Hm, that should work. A couple diagnoses: what user does apache run as? when you're logged in as that user, from the shell, does @INC look right? -- http://kw.pm.org/ - Kitchener-Waterloo Perlmongers - da@kw.pm.org On Fri, 2 Apr 2004, Christopher Calzonetti wrote: > Okay, so I've tried searching through all sorts of places for the > answer for this, and have had no success. Maybe somebody on this > list knows. > > I've got a bunch of perl modules installed in a semi-reasonable > place, considering my setup, namely OSX, using fink. The modules > in question are in > > /sw/lib/perl5:sw/lib/perl5/darwin > > And my environment variable PERL5LIB is set up as such. So when I run > perl -V, I see all the directories in @INC, as I expect. > > However, when under apache, my same perl scripts cannot find these > extra directories. I fiddled around as best I could, and I wrote > a quick little script to help me check. PERL5LIB is set properly, > but @INC is nevertheless missing the key directories. > > All the solutions on the web all seem to refer to mod_perl solutions. > Not that I can get it working under mod_perl either, but I'd really > like perl under the CGI handler to be able to find the libraries > without having to change all my scripts to add a use lib ... command > or two or three. > > Any thoughts? > -- > Christopher Calzonetti, Technical Lead, Trig.Net > Web: http://www.trig.net/ Mail: mailto:chris@trig.net > _______________________________________________ > kw-pm mailing list > kw-pm@mail.pm.org > http://mail.pm.org/mailman/listinfo/kw-pm > From elbie at trig.net Fri Apr 2 18:31:47 2004 From: elbie at trig.net (Christopher Calzonetti) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: References: <20040402220220.GA85369@trig.net> Message-ID: <20040403003147.GA10415@trig.net> Okay, to answer everyone: First off, while changing the @INC on a program by program basis would work (which is what use lib '...' does), or by including extra libs on the #! path, I would rather not do that, as it ends up making things sorta messy, especially as I want these script to look as nice as possible on different machines. That said, doing so _does_ work. Which kinda indicates that the file permissions is not the issue, though I'd be surprised if it was, as the paths are not showing up in the @INC list. As for which user apache runs as, it runs under user www, which doesn't have a shell to speak of. The user information has the shell set to /usr/bin/false. From daniel at coder.com Fri Apr 2 21:56:05 2004 From: daniel at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: <20040403003147.GA10415@trig.net> Message-ID: On Fri, 2 Apr 2004, Christopher Calzonetti wrote: > As for which user apache runs as, it runs under user www, which doesn't > have a shell to speak of. The user information has the shell set to > /usr/bin/false. Ah- but the user still has environment variables. You can run things effectivly as the webserver by: su to root su - www and you can run your cgis from the command-line with the same permissions as the webserver. Useful for diagnosing environment problems. ...and if you do this (he said, guessing...) perl -V will tell you that www's PERL5LIB is missing the directories you added to your own PERL5LIB. You can fix that by modifying the script that starts apache to load the environment variable into the parent shell. But when I tried this now, I couldn't get it to work properly. What did work like a charm was adding this to apache's httpd.conf, which loads the environment variable directly into apache: LoadModule env_module /usr/lib/apache/1.3/mod_env.so SetEnv PERL5LIB /home/daniel/work/foo Hope that helps. -- http://coder.com/ - Prescient Code Solutions - (519) 575-3733 da@coder.com From elbie at trig.net Sat Apr 3 09:20:20 2004 From: elbie at trig.net (Christopher Calzonetti) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: References: <20040403003147.GA10415@trig.net> Message-ID: <20040403152020.GA67543@trig.net> On Fri, Apr 02, 2004 at 10:56:05PM -0500, Daniel R. Allen wrote: > On Fri, 2 Apr 2004, Christopher Calzonetti wrote: > > > As for which user apache runs as, it runs under user www, which doesn't > > have a shell to speak of. The user information has the shell set to > > /usr/bin/false. > > Ah- but the user still has environment variables. You can run things > effectivly as the webserver by: > > su to root > su - www > ... Actually, this is not true. At least, it's not for OSX. Well, it's sort of true, I suppose, but in addition to changing to the new user's environment variables, it also changes the user's shell. /usr/bin/false will exit immediately, and thus kick me right back out again. > ...and if you do this (he said, guessing...) perl -V will tell you that > www's PERL5LIB is missing the directories you added to your own PERL5LIB. Modifying the user info for www, I changed the shell to sh, so I _could_ check the environment variables. This allowed me to check that indeed the extra directories where not showing up in @INC. I'm not sure what this gets me though, as no shell is started for the webserver. > You can fix that by modifying the script that starts apache to load the > environment variable into the parent shell. But when I tried this now, I > couldn't get it to work properly. I also tried that and couldn't get it to work. I tried adding the following to the top of apachectl: PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin export PERL5LIB but this didn't seem to carry through to Apache. A quick check of the docs revealed that most environment variables are stripped out of the environment, leaving only a "safe" subset to be passed on to CGIs called by apache. > What did work like a charm was adding this to apache's httpd.conf, which > loads the environment variable directly into apache: > > LoadModule env_module /usr/lib/apache/1.3/mod_env.so > SetEnv PERL5LIB /home/daniel/work/foo In fact, this is already what I have in my httpd.conf file, and I can confirm that PERL5LIB is being passed through as you say. I mentioned this in my original e-mail. HOWEVER, perl CGI scripts called by Apache, though the value of $ENV{PERL5LIB} is set correctly, STILL DO NOT HAVE the extra directories in @INC! Weird. From akohlsmith-pm at benshaw.com Sat Apr 3 09:27:47 2004 From: akohlsmith-pm at benshaw.com (Andrew Kohlsmith) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: <20040403152020.GA67543@trig.net> References: <20040403003147.GA10415@trig.net> <20040403152020.GA67543@trig.net> Message-ID: <200404031027.47672.akohlsmith-pm@benshaw.com> > Actually, this is not true. At least, it's not for OSX. Well, it's sort > of true, I suppose, but in addition to changing to the new user's > environment variables, it also changes the user's shell. /usr/bin/false > will exit immediately, and thus kick me right back out again. use "su user", not "su - user", as the latter actually tries to log in instead of just change the uid. Also use "env -" -- it will do what you desire, I think, if what you're out to do is wipe out your environment variables and start anew. I do something similar for my WINE user: env - HOME=/home/wine \ TERM=ansi-mini \ PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/scripts \ QTDIR='D:\Qt\3.1.2' \ QMAKESPEC='win32-msvc' \ MSDevDir='\MSDev98' \ INCLUDE='d:\vs\vc98\include;d:\openssl\include;d:\psi-cvs\qca\src' \ LIB='d:\vs\vc98\lib;d:\openssl\lib;d:\psi-cvs\qca' \ LIBPATH='d:\vs\vc98\lib;d:\openssl\lib;d:\psi-cvs\qca' \ wine --debugmsg -all,+err -- $* Regards, Andrew From arguile at lucentstudios.com Sat Apr 3 09:36:20 2004 From: arguile at lucentstudios.com (Arguile) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: <20040403152020.GA67543@trig.net> References: <20040403003147.GA10415@trig.net> <20040403152020.GA67543@trig.net> Message-ID: <1081006465.2462.2533.camel@broadswd.local> On Sat, 2004-04-03 at 10:20, Christopher Calzonetti wrote: > HOWEVER, perl CGI scripts called by Apache, though the value of > $ENV{PERL5LIB} is set correctly, STILL DO NOT HAVE the extra directories in > @INC! Weird. Are you running in taint mode? If so all environment vars are thrown away. From daniel at coder.com Sat Apr 3 11:40:17 2004 From: daniel at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] Perl CGIs, modules and Apache. In-Reply-To: <200404031027.47672.akohlsmith-pm@benshaw.com> Message-ID: On Sat, 3 Apr 2004, Andrew Kohlsmith wrote: > use "su user", not "su - user", as the latter actually tries to log in instead *slaps forehead* sorry, I got that backwards... -- http://coder.com/ - Prescient Code Solutions - (519) 575-3733 da@coder.com From da at coder.com Sat Apr 10 14:22:08 2004 From: da at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:34 2004 Subject: [kw-pm] April Meeting- Wed. 21 April, 7pm Message-ID: Announcing the April meeting of the KITCHENER-WATERLOO Perl Mongers - kw.pm - For enthusiasts of the Perl programming language Topic: Web Services with Perl The World Wide Web can be used for application-to-application communication. These programmatic interfaces are referred to as Web services. A few scoops of XML-RPC, a little SOAP, a dash of WSDL, UDDI and voila- acronym soup! Come along as we explore how to make the acronyms do some real work with the power of Perl. Date/Time: Wednesday the 21st of April, 2004 at 7pm Location: University of Waterloo Bioinformatics Lab, Davis Centre room 2305 For directions and a map, please check our FAQ: http://kw.pm.org/faq.html After the meeting we will adjourn to Morty's for drinks. Parking: The closest legal parking is probably the 'B' lot, which has public parking after 4pm for $3 (coin only). The entrance is on Phillip Street, just after the University Plaza going East on University Ave. From da at coder.com Mon Apr 19 15:03:00 2004 From: da at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:35 2004 Subject: [kw-pm] Reminder: Meeting This Wendesday Message-ID: I just wanted to make a reminder of our meeting this Wednesday, 7pm. ---- Topic: Web Services with Perl The World Wide Web can be used for application-to-application communication. These programmatic interfaces are referred to as Web services. A few scoops of XML-RPC, a little SOAP, a dash of WSDL, UDDI and voila- acronym soup! Come along as we explore how to make the acronyms do some real work with the power of Perl. Date/Time: Wednesday the 21st of April, 2004 at 7pm Location: University of Waterloo Bioinformatics Lab, Davis Centre room 2305 For directions and a map, please check our FAQ: http://kw.pm.org/faq.html After the meeting we will adjourn to Morty's for drinks. Parking: The closest legal parking is probably the 'B' lot, which has public parking after 4pm for $3 (coin only). The entrance is on Phillip Street, just after the University Plaza going East on University Ave. From akohlsmith-pm at benshaw.com Mon Apr 19 15:14:01 2004 From: akohlsmith-pm at benshaw.com (Andrew Kohlsmith) Date: Mon Aug 2 21:31:35 2004 Subject: [kw-pm] Reminder: Meeting This Wendesday In-Reply-To: References: Message-ID: <200404191614.01512.akohlsmith-pm@benshaw.com> > I just wanted to make a reminder of our meeting this Wednesday, 7pm. Awww, shazbot! I have had a glitch come up in my personal life that prevents me from going to this... this is a problem as I was supposed to give a little spiel on XMLRPC. I *totally* screwed up this one... I apologize. Lloyd, I am truly sorry. Ugh. -A. From daniel at coder.com Mon Apr 19 15:32:50 2004 From: daniel at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:35 2004 Subject: [kw-pm] Reminder: Meeting This Wendesday In-Reply-To: <200404191614.01512.akohlsmith-pm@benshaw.com> Message-ID: If he'd like, Lloyd can call on me as a pinch-hitter. I've just done a little project to convert XML into HTML using XSLT, and it wasn't very painful either, so I'd be happy to share what little I've learned. Yes, this has very little to do with web services, but some of the acronyms are the same. :-) -Daniel From da at coder.com Tue Apr 20 13:05:43 2004 From: da at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:35 2004 Subject: [kw-pm] YAPC::NA in Buffalo Message-ID: In a personal email, Shuchit asked me this: > On a different note, anyone going to YAPC::NA ? I'm definitely going, as I'm giving two talks. Anybody else going? See http://yapc.org/America/ for details... This year it's June 16-18. Still $85 plus housing. -Daniel http://coder.com/ - Prescient Code Solutions - (519) 575-3733 da@coder.com From da at coder.com Tue Apr 20 13:21:35 2004 From: da at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:35 2004 Subject: [kw-pm] YAPC::NA in Buffalo Message-ID: Whoops, that is, $85 USD. On Tue, 20 Apr 2004, Daniel R. Allen wrote: > Still $85 plus housing. From da at coder.com Thu Apr 22 09:44:30 2004 From: da at coder.com (Daniel R. Allen) Date: Mon Aug 2 21:31:35 2004 Subject: [kw-pm] Minutes up Message-ID: Working under the assumption that I wouldn't actually do minutes if I didn't do them now, I've put up minutes for last night's meeting; Lloyd's slides are also on the site. Thanks Lloyd! We might have content and presenters for our two next talks... And a question. June's scheduled meeting date is in the middle of YAPC. Do we want to meet the second or fourth Wednesday of June? Or in July? I guess it first depends on Arguile's schedule; and second on whether people are planning to be elsewhere. Please give me a shout off-list if you've got preferences! -Daniel http://coder.com/ - Prescient Code Solutions - (519) 575-3733 da@coder.com