RE: perl's system() w/ apache under win2k
Greetings. -Original Message- [...] Apparently permissions on winNT is something unexpected and new for those who are used to older win32 systems. Moreover, error_log usually tells what the exact problem is when the code is written properly to report errors (e.g., checking the return status of system()). My guess is that this should work on winNT too. I am a little late on this one (vacations) however, it may be of general [win32] interest highlighting the fact that the allow service to interact with desktop thingy is just the start of a more general can of worms that Win{Nt,2K} permissions and general system interaction open up. (None of these is mp specific, so sue me :-) ) For documentation purposes I am listing my most popular pet peeves below: i) allow service to interact with desktop Not only an issue with GUI-enbled apps, but also with apps that like to use popups (say, through MsgBox) and hang forever waiting fot somebody to press OK ii) Access to networked disks/resources NT services, by default, run as user LocalSystem which is pretty powerful on the local machine and totally powerless network-wide. This means that most accesses to network resources *WILL* fail UNLESS the service is being told to impersonate a specific user, whose password must be known and typed in the like-labeled entry. If this course of action is chosen, then a special user should be created for this purpose: this will prevent mysterious failures when a sysadmin changes a password...But read on. iii) DCOM configuration. This can kick in for applications using out-of-process COM servers, most often after the impersonation thing (see (ii)) has been set up. The fact that DCOM is involved is a little puzzling, however WinNT and siblings enforce DCOM security rules also across process boundaries. Basically, one needs to be sure that the user (LocalSystem or whatever) that the apache service impersonates is also in the access/launch/configure list for the needed COM servers (this is tipically the default security list, but an application is permitted to specify its own). Sounds horrid enough? Wait 'til you've seen the interface of DCOMCNFG.exe - the application that is used to configure DCOM security... (by the way, to invoke this one, ypu need to type dcomcnfg in the Start-Run... dialog. It is not on any menu/control panel applet I know of). iv) Mounted drives Drives that are permanently assigned a letter will not be available when noone is logged on - this cannot be solved by impersonation and I do not know wether a workaround is available. Finding these pitfalls is particularly tricky because they tend to disappear if someone is logged on the machine, or if apache is run manually rather than as a service etc. With regard to point (iii) it is interesting to note that IIS works around it by creating a special user it runs under (IUSR_fubar). Cheers, alf
Re: Query
George Valpak wrote: Sounds like you need 2 apaches, on separate physical servers - I agree, the proxy approach is your best choice, and it gives other performance benefits as well, described in the documentation. - Perrin
Re: [mp2] config: Perl directive missing closing ''
Thanks for pointing me in that direction. While Perl did not work as you suggested (produced error 'no Perl handler specified'), it did cause me to grep for this error message, and it is in file src/modules/perl/modperl_cmd.c. I was able to get some information from that code: mod_perl wants directive of the form Perl handler=Some::Handler where Some::Handler actually looks like a valid handler, i.e. has a subroutine called handler(). The module is compiled and handler() is called during config parse time. Unfortunately, I could not figure out how to set Apache directives from that subroutine. Simply setting global $ServerAdmin does not produce the desired effect. Is there a global Apache config namespace or hash? Also, my httpd.conf has things like this: Perl $PerlConfig = VirtualHost _default_:$ssl_port # some directives here. /VirtualHost ; /Perl I am at a loss as to how I'd go about replicating these dynamically generated directives in the new mod_perl model. Eagerly waiting for suggestions, - Dmitri. On 8 Jan 2003, Philippe M. Chiasson wrote: On Wed, 2003-01-08 at 00:56, Dmitri Tikhonov wrote: Hi, Simply put, there is a small difference in behaviour (bug) in apache's config parsing code. For now, just put Perl instead of Perl Apache assumes containers to always have a value argument, like in Foo /var. Will eventually be fixed though. I am in the process of converting to Apache2/mod_perl2. My old httpd.conf file contains these lines (stuff in the middle omitted): - LoadModule perl_module /usr/libexec/mod_perl.so Perl $ServerAdmin = 'admin@'.`hostname`; /Perl - After LoadModule directive, I added this line: - PerlRequire /etc/httpd/conf/startup.pl - (taken straight from ./docs/user/config/config.pod of mod_perl distribution) and uncommented 'use Apache::compat' line. When I start apache, I see this error: - [root@audrey conf]# /usr/sbin/httpd -f /etc/httpd/conf/httpd.conf Syntax error on line 90 of /etc/httpd/conf/httpd.conf: Perl directive missing closing '' [root@audrey conf]# - I only found this recent thread -- http://www.mail-archive.com/dev@perl.apache.org/msg03485.html -- I think it talks about Perl directive support not being finished (?) Is that correct? Documentation on Perl section is empty (http://perl.apache.org/docs/2.0/user/config/config.html#C_E_lt_PerlE_gt___Sections). I have no idea what's going on. What am I missing? Is there another set of documentation that explains this behavior? My setup: apache 2.0.43, mod_perl 1.99_07. Thanks in advance. - Dmitri. Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B) http://gozer.ectoplasm.org/F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5 Q: It is impossible to make anything foolproof because fools are so ingenious. perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/print||$$++redo}'
Sticky pnotes conclusion
Hello, Over the weekend I posted here with questions about a problem where variables stored in pnotes did not get garbage collected. Thanks to some very helpful hints I was able to determine that mod_perl was leaking pnotes in a request with an internal redirect. A patch to fix that was posted to the dev list. If you have pages with internal redirects where the redirected-to code uses pnotes then you should watch out for leaks until the patch makes it into a full release. I also had a second more serious problem I was hoping that would also be solved, but it turns out it was completely different and not related to mod_perl at all. Here is an example of the second leak we had: my $dbh = DBI-connect(...); $dbh-disconnect(); $dbh-do(create database 20030107_test); $dbh-do(drop database 20030107_test); That example leaks around 4k every request. In our server, there was something else going on causing it to leak multiple megabytes per request (I still don't know what). Simply adding in checks to reconnect unless $dbh-{Active} does the trick. I'll submit a bug to the DBI people, even though that is a horrible abuse of the class. That example makes us look pretty dumb, let me explain how it happened since it may affect you too. We do inter-request caching of $dbh in pnotes. We rely on the destructor of DBI to disconnect; we don't use disconnect() anywhere in our code. We do however use Apache::AuthTIcket-- which does disconnect-- and we pass it our cached $dbh. So you can see how the above example could occur: AuthTicket grabs a dbh, then disconnects it, we still use it because we assume it is connected like normal, but the DBI doesn't like that sequence of events (it recovers the connection, but leaks). Thanks for all your help, esp. the good hints about the per request cleanup! John
Re: Sticky pnotes conclusion
John Heitmann wrote: That example makes us look pretty dumb, let me explain how it happened since it may affect you too. We do inter-request caching of $dbh in pnotes. We rely on the destructor of DBI to disconnect; we don't use disconnect() anywhere in our code. We do however use Apache::AuthTIcket-- which does disconnect-- and we pass it our cached $dbh. So you can see how the above example could occur: AuthTicket grabs a dbh, then disconnects it, we still use it because we assume it is connected like normal, but the DBI doesn't like that sequence of events (it recovers the connection, but leaks). It doesn't seem necessary for Apache::AuthTicket to do that. However, people using Apache::DBI would not have a problem with this since the disconnect doesn't actually disconnect. - Perrin
OSCON ideas
As many of you probably know, the call for participation in this year's Open Source Conference has gone out (http://conferences.oreillynet.com/cs/os2003/create/e_sess). I'm thinking about possible talks to submit and I want a little feedback on what people are most interested in. Here are two options I'mconsidering: 1) Database Objects in Perl This talk would focus on the database mapping options for Perl, including modules like Tangram, Class::DBI, SPOPS, etc. It would examine the differences in features, ease of use, and performance and include a set of hand-coded classes using straight DBI for comparison. 2) The Perl Pet Store This would be a discussion of porting the J2EE Pet Store reference application to Perl. It would cover Perl equivalents for various J2EE features, and talk about what was easier or harder to do in Perl. Because of the size of the Pet Store codebase and the complexity of the environment required to run it (multiple databases, etc.), it may not be possible to do a good performance benchmark. However comparisons on other fronts (amount of code, ease of maintenance, etc.) would be made. What do you guys think? - Perrin
RE: OSCON ideas
1) Database Objects in Perl This talk would focus on the database mapping options for Perl, including modules like Tangram, Class::DBI, SPOPS, etc. It would examine the differences in features, ease of use, and performance and include a set of hand-coded classes using straight DBI for comparison. This would be excellent. I know I personally have struggled mightily with Tangram (I still to this day don't know how to select only records where column A is not null - tore MUCH hair out of head over that one) and would like to know about options that are easier to use. 2) The Perl Pet Store This would be a discussion of porting the J2EE Pet Store reference application to Perl. It would cover Perl equivalents for various J2EE features, and talk about what was easier or harder to do in Perl. Because of the size of the Pet Store codebase and the complexity of the environment required to run it (multiple databases, etc.), it may not be possible to do a good performance benchmark. However comparisons on other fronts (amount of code, ease of maintenance, etc.) would be made. I'd be curious on this if only to have some ammunition to show people who say Perl isn't as good as Java and that sort of thing. Also, a reference application on par with the pet store would be a valuable tool in the toolbox for all of us Perl folks and people new to Perl but familiar with Java would probably love this. If I had to pick, though, the first proposal would have more of an impact on my day-to-day perl duties. -Fran
Passing CGI environment to subprograms
Hi, I have a mod_perl script that exec's (via backticks) another program. This program actually needs the CGI enviroment variables to perform correctly (it's a proprietary program, it was actually called by shell CGI initially, this approach cuts our exec's in half until we get an alternative for the subprogram). Based on some stuff in the list archive, I thought that Apache::SubProcess would handle this but it appears to just be a cleaner way to get the output of the called program as opposed to setting it's environment. Any help
Re: Passing CGI environment to subprograms
I've now located and tried the subprocess_env() in conjunction w/ spawn_proc_prog(). I just do a foreach on the ENV hash and stuff the values into subprocess_env(). That works (I have a test perl subprogram that just dumps the ENV), but now I am not able to get the output of the program. I pasted in the read_data() func from the example and I have a single scalar accepting the return value from spawn_proc_prog() per the example and that is supposed to give me the output filehandle. Any suggestions? - Original Message - From: Erich Oliphant [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 08, 2003 4:46 PM Subject: Passing CGI environment to subprograms Hi, I have a mod_perl script that exec's (via backticks) another program. This program actually needs the CGI enviroment variables to perform correctly (it's a proprietary program, it was actually called by shell CGI initially, this approach cuts our exec's in half until we get an alternative for the subprogram). Based on some stuff in the list archive, I thought that Apache: :SubProcess would handle this but it appears to just be a cleaner way to get the output of the called program as opposed to setting it's environment. Any help
Re: [mp2] input filter
Steve wrote: I'm having some trouble configuring an input filter.. I'm using Apache 2.0.43, mod_perl 1.99_08-dev and perl 5.8.0. In httpd.conf, I just did this inside a VirtualHost PerlInputFilterHandler myApache::Filters::filter_in My code looks something like this: package myApache::Filters; #here I loaded different modules etc.. sub filter_in : FilterConnectionHandler{ my ($filter, $bb, $mode, $block, $readbytes) = @_ my $rv =$filter-next-get_brigade($bb, $mode, $block, $readbytes); return $rv unless $rv = APR::SUCCESS; print STDERR INPUT FILTER\n; my $c = $filter-c return Apache::OK; } Are you sure that this is the code that you run? How about adding a semicolon after $filter-c In your original post you've asked whether it's OK that the debug warning is printed twice. Yes, that's OK. A filter is called one or more times depending on how other filters output their data. You should get the filter called once per bucket brigade. This is pretty much just taken from the mod_perl filter documenation, so I'm pretty sure the code is OK. My problem is this: From the time I hit refresh in my browser to the time the content appears takes a very long time. The request completes eventually, it just takes forever. As soon as I take the filter handler out of httpd.conf it works perfectly Is this a configuration issue? Anyone have any ideas as to why this happens? While it responds slowly, do you see the debug printouts coming out slowly as well? Try to use the MyApache::FilterSnoop filter http://perl.apache.org/docs/2.0/user/handlers/filters.html#All_in_One_Filter and see where things are delayed. Also try using a command line useragent: lynx --source, lwp-request, etc. So you will see the output as it comes out. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: OSCON ideas - MVC talk
On Wed, 8 Jan 2003, Perrin Harkins wrote: I am planning to submit a proposal for a introduction talk on MVC in a web environment. It is mostly talking about why (seperation of concerns etc) it's (sometimes) nicer than whatever you used to do and how you apply the goals to the actual implementation. In 90 minutes I think I can also go briefly into examples of actual models, controllers and templates. I think it could also be a tutorial[1], but tutorials bore me so much. So I don't think I'd want to do that. Like Perrin I would like feedback on the idea before putting in my proposal. :-) - ask [1] Except then I would have to write many more slides; I already have a ~70 minutes talk about it with slides, illustrations and all sorts of things. :-) -- ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();
Re: OSCON ideas - MVC talk
Ask Bjoern Hansen writes: On Wed, 8 Jan 2003, Perrin Harkins wrote: Like Perrin I would like feedback on the idea before putting in my proposal. I've also been asked if anyone has a wishlist of talks they'd like to see at the conference. Ideally they'd be talks I'd pay money to see but I could live with talks I'd like to see even though they're hard to justify to my boss. Feel free to brainstorm here as much as you want :-) Nat (yes, yes, we all want to see the How mod_perl 2.0 was finished but I'm not sure that's on the cards :-)
Re: OSCON ideas - MVC talk
Nathan Torkington wrote: (yes, yes, we all want to see the How mod_perl 2.0 was finished but I'm not sure that's on the cards :-) Since the submission deadline is one week that certainly would not happen. Though an improved mod_perl 2.0 by Example tutorial is definitely a must for those who want to get familiar with most of the 2.0 new features. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: OSCON ideas - MVC talk
Stas Bekman wrote: Since the submission deadline is one week that certainly would not happen. For some reason I thought the deadline was Jan 15th, I see that it's Feb 15th. Submit your proposals here: http://conferences.oreillynet.com/cs/os2003/create/e_sess __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: OSCON ideas
On Wednesday, January 8, 2003, at 01:14 PM, Perrin Harkins wrote: 1) Database Objects in Perl 2) The Perl Pet Store What do you guys think? I say both. :-) David -- David Wheeler AIM: dwTheory [EMAIL PROTECTED] ICQ: 15726394 http://david.wheeler.net/ Yahoo!: dew7e Jabber: [EMAIL PROTECTED]
Re: OSCON ideas - MVC talk
On Thu, 9 Jan 2003, Stas Bekman wrote: Stas Bekman wrote: Since the submission deadline is one week that certainly would not happen. For some reason I thought the deadline was Jan 15th, I see that it's Feb 15th. Wow, you scared the crap out of me for a second. I want to submit some talks but it would have been a scramble to submit some for next week! -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: OSCON ideas
On Wed, Jan 08, 2003 at 04:14:47PM -0500, Perrin Harkins wrote: What do you guys think? As an OSCON attendee for the past few years, I've found only a few talks that really were helpful. One thing that I would love to see are practical implementations of perl applications. For example, we use Mason coupled to a back end API that connects directly to postgres. The API/Mason stuff works like a MVC. It's all pretty standard, and works very well. I'm sure other people have much more interesting examples. This kind of talk would be directed at people who really grasp all the concepts of perl already, and are looking for something to spark their intrest again. Almost like the perl lightning talks, but more focused on application models. Just some thoughts... Rob