PerlSwitches -M and @INC
Hi, i am trying Apache 2.0.44 and mod_perl 1.99_08. httpd.conf :Bevor all virtual hosts PerlRequire /usr/local/apache2/conf/virtual/startup.pl The content of startup.pl is as in the mod_perl documentation including the "use Apache::compat()" directive. I one of my V-hosts i say (as described in the documentation): PerlOptions +Parent PerlSwitches -Mlib=/et/www/envirotex/lib When I start the server i get the error message: " [Wed Jan 22 13:52:07 2003] [error] Can't locate loadable object for module Apache::Constants in @INC (@INC contains: /et/www/envirotex/lib /usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/mod_perl.pm line 14 Compilation failed in require at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6. Compilation failed in require at /et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3. BEGIN failed--compilation aborted at /et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3. Compilation failed in require at (eval 1) line 3. [Wed Jan 22 13:52:07 2003] [error] Can't load Perl module Emma::AuthCookieHandler for server www.et:0, exiting... " It seems to me, that all of the Apache2 paths create by the "use Apache2" directive are no more present in the @INC Array. I tried a lot of things with several combinations of PerlSwitches (-M, -I, -Mblib, -Mlib), and startup files, but I never got the result i want: I would like to load some "private" Modules under "/et/www/envirotex/lib" and all the other things should work too. Helmut
[MP2] pb with startup.pl and LibXML
Hi I have SERVER_SOFTWARE: Apache/2.0.43 (Win32) mod_perl/1.99_08-dev Perl/v5.8.0 PHP/4.3.0 installed from theoryx5 all-in-one archive here is the problem I have : - package testxml; use strict; use warnings; use XML::LibXML(); use XML::LibXSLT(); use Data::Dumper; my $base='c:/apache2/mason'; my $promod= XML::LibXSLT->new->parse_stylesheet( XML::LibXML->new->parse_file("$base/stylesheets/test.xsl")); print Dumper $promod ; 1; --- the above script runs ok when PERL testxml.pm is run. (outside of any apache environment) Dumper prints bless XML::LibXSLT::Stylesheet.. showing all parsing ok (the stylesheets is simplisssima one tag sheet) when it is USEed from startup.pl (# removed below in startup) then it also prints the line bless ... but apache issues a fatal error and refuses to start "instruction 0X28027104 memory cant be read !" here is the startup.pl use Apache2 (); use lib 'c:/apache2/mason/lib'; use ModPerl::Util (); use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::Server (); use Apache::ServerUtil (); use Apache::Connection (); use Apache::Log (); use Apache::Const -compile => ':common'; use APR::Const -compile => ':common'; use APR::Table (); use Apache::compat (); use ModPerl::Registry (); use CGI (); use XML::LibXML(); use XML::LibXSLT(); #use testxml; 1; same thing if you omit the xslt step in the testxml script I pointed out this problem from the early distribution of modperl2, it's not recent. thanks pascal Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 /mn) ; tél : 08 92 68 13 50 (0,34/mn)"
Re: [MP2] pb with startup.pl and LibXML
On Wed, 22 Jan 2003, [iso-8859-1] [EMAIL PROTECTED] wrote: > Hi I have > > SERVER_SOFTWARE: Apache/2.0.43 (Win32) mod_perl/1.99_08-dev > Perl/v5.8.0 PHP/4.3.0 > > installed from theoryx5 all-in-one archive > > > here is the problem I have : > - > package testxml; > use strict; > use warnings; > use XML::LibXML(); > use XML::LibXSLT(); > use Data::Dumper; > my $base='c:/apache2/mason'; > my $promod= > XML::LibXSLT->new->parse_stylesheet( > XML::LibXML->new->parse_file("$base/stylesheets/test.xsl")); > print Dumper $promod ; > 1; > --- > > the above script runs ok when PERL testxml.pm is run. (outside > of any apache environment) > Dumper prints > > bless XML::LibXSLT::Stylesheet.. > > showing > all parsing ok (the stylesheets is simplisssima one tag sheet) > > when it is USEed from startup.pl (# removed below in startup) > then > it also prints the line > > bless ... > > but apache issues a fatal error and refuses to > start "instruction 0X28027104 memory cant be read !" > > > here is the startup.pl > > use Apache2 (); > use lib 'c:/apache2/mason/lib'; > use ModPerl::Util (); > use Apache::RequestRec (); > use Apache::RequestIO (); > use Apache::RequestUtil (); > use Apache::Server (); > use Apache::ServerUtil (); > use Apache::Connection (); > use Apache::Log (); > use Apache::Const -compile => ':common'; > use APR::Const -compile => ':common'; > use APR::Table (); > use Apache::compat (); > use ModPerl::Registry (); > use CGI (); > use XML::LibXML(); > use XML::LibXSLT(); > #use testxml; > 1; > > > same thing if you omit the xslt step in the testxml script > > I pointed out this problem from the early distribution of > modperl2, it's not recent. Is it just when used from the startup file that problems arise? Does it run OK within Apache as, eg, part of a registry script? And if not, is it OK within an ordinary cgi script? Does adding a LoadFile "/Path/to/libxml2.dll" directive, before pulling in the startup script, help? (in the distribution from our site, libxml2.dll is in the Perl/bin/ directory). -- best regards, randy
mysql password encryption
All, I wish to let a user use the same password for them to authenticate to a multitude of mysql Databases AND to authenticate themselves on my modperl site. the problem I have is that I store the password in the database as a Password field. However when I wish to use DBI to connect to another mysql database I cannot use the Password stored in the database as it comes out encrypted. I really don't want to store the unencrypted password anywhere on the system. Is there a way to let DBI/mysql know that the password I am giving them is ALREADY encrypted? Has anybody else solved a problem like this? Regards Marty
Re: mysql password encryption
Martin Moss wrote: the problem I have is that I store the password in the database as a Password field. However when I wish to use DBI to connect to another mysql database I cannot use the Password stored in the database as it comes out encrypted. I really don't want to store the unencrypted password anywhere on the system. Is there a way to let DBI/mysql know that the password I am giving them is ALREADY encrypted? Why don't you just encrypt it yourself and store it in a VARCHAR? - Perrin
Re: mysql password encryption
Quoting Martin Moss <[EMAIL PROTECTED]>: > All, > > I wish to let a user use the same password for them to authenticate to a > multitude of mysql Databases AND to authenticate themselves on my modperl > site. > the problem I have is that I store the password in the database as a > Password field. However when I wish to use DBI to connect to another mysql > database I cannot use the Password stored in the database as it comes out > encrypted. I really don't want to store the unencrypted password anywhere > on the system. Is there a way to let DBI/mysql know that the password I am > giving them is ALREADY encrypted? A feature like that would defeat the purpose of encrypting the password in the first place. The point of encrypting the password is so that if someone gets their hands on the password list, they can not use the encrypted password to access the system. They would have to crack the passwords first before using them to access the system. By allowing someone to access the system with an already encrypted password, then your passwords might as well not be encrypted at all. Since you are using MySQL, have you looked at using the mysql_read_default_file option to store your password in a config file? Using a DSN like the following allows you to keep the username and password in a config file. Check the DBD::mysql perldocs for more info, and the MySQL docs for all the parameters you can put in such a file. DBI:mysql:test;mysql_read_default_file=/etc/mysql/test.my.conf and in /etc/mysql/test.my.conf [client] user = www password = thebigsecretpassword Then protect the file: chown www /etc/mysql/test.my.conf chmod 400 /etc/mysql/test.my.conf You still have the password in plain text, but it is readable only by root and the user that runs the webserver. You can use this to connect to multiple MySQL servers as long as the access tokens are the same on all servers. Cees
Re: [MP2] pb with startup.pl and LibXML
Does adding a LoadFile "/Path/to/libxml2.dll" directive, before pulling in the startup script, help? (in the distribution from our site, libxml2.dll is in the Perl/bin/ directory). -- best regards, randy I have no libxml2.dll file from the all-in-one 30 or so MB archive donwloaded from theoryx5 i only have libxml.dll in perl/site/lib/auto/xml/libxml I do have one libxml2.dll in my path from a separate xmlsoft download... maybe this is the reason of problems ? apache issues the segfault (popup window) on every situation : mason modperl, registry or simple cgi. but then it restarts itself immediatly and serves the request (after a rather long restarting delay). the segfault sometimes does not happen for two or three times and then again. pascal Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 /mn) ; tél : 08 92 68 13 50 (0,34/mn)"
Re: Re: [MP2] pb with startup.pl and LibXML
On Wed, 22 Jan 2003, [iso-8859-1] [EMAIL PROTECTED] wrote: > > Does adding a > > LoadFile "/Path/to/libxml2.dll" > > directive, before pulling in the startup script, help? > > (in the distribution from our site, libxml2.dll is in > > the Perl/bin/ directory). > I have no libxml2.dll file from the all-in-one 30 or so MB > archive donwloaded from theoryx5 Sorry for the confusion - I got mixed up with distributions. > i only have libxml.dll in perl/site/lib/auto/xml/libxml > I do have one libxml2.dll in my path from a separate xmlsoft > download... maybe this is the reason of problems ? That might be You might try an upgraded LibXML/LibXSLT package from http://theoryx5.uwinnipeg.ca/ppms/ - this has fixed a couple of bugs. Both of these require XML-LibXML-Common, which does contain the libxml2.dll referred to above. The dll is, in theory, supposed to be installed from a post-install script under ppm, but this might not work within ppm3 - if one is using ppm3, one can grab XML-LibXML-Common.tar.gz from http://theoryx5.uwinnipeg.ca/ppms/x86/ and extract libxml2.dll from there. This dll should go somewhere within the PATH, and is the one I suggested to load with the LoadFile directive. > apache issues the segfault (popup window) on every situation : > mason modperl, registry or simple cgi. > but then it restarts itself immediatly and serves the request > (after a rather long restarting delay). > the segfault sometimes does not happen for two or three times > and then again. Weird -- best regards, randy
server startup shutdown
I have XML file and don`t want parse/serialize on each request how implement this: 1) XML parsed on startup 2) All modules work whith same object 3) XML serialize on server shutdown P.S. Apache 2 mod_perl 2
Re: [mp2] Apache::RequestRec, IPC::Open[23] problem
On Wed, 2003-01-22 at 08:10, Stas Bekman wrote: > Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE > interfaces from 1.0. Though I doubt that this will work, IPC::Open* have > always had problems with mod_perl. IPC::Run should be used instead for now. > Hopefully will be able to look more into this issue much later unless someone > beats me to it. Thanks for the quick reply, Stas. I tried it out and that particular error is gone now, but the W3C Validator still doesn't quite work, whereas as a normal CGI it does. I didn't notice any errors, but valid pages just don't validate under mod_perl (they do as normal CGI). I know this is a too vague explanation, but I don't have time to dig deeper now. Cheers, -- \/ille Skyttä ville.skytta at iki.fi
Re: server startup shutdown
[EMAIL PROTECTED] wrote: I have XML file and don`t want parse/serialize on each request how implement this: 1) XML parsed on startup 2) All modules work whith same object It doesn't look to me like you can share objects across threads effectively at this time. You can share a hash ref, but that doesn't share things tha are referenced within that hash and it doesn't share the blessing. I think you will need to do this using standard data sharing methods, like IPC::MM or MLDBM::Sync. 3) XML serialize on server shutdown That sounds dangerous. What happens if your server crashes or otherwise shuts down abnormally? You will lose everything. Much safer to write your updates to disk, even if you only do it with Storable or MLDBM::Sync and then transform it back to XML later. - Perrin
Configuration in module vs in apacheconfig...
{ yes, I saw the chapter in Stas Bekman's book, that's not exactly what I discuss } So, there is some mod_perl application. It has a lot of configurable elements - from urls being used to constants predefining contents of different drop-down boxes. Currently the config information is spread between: - apache config file included to httpd.conf (let's call it myapp.conf), where different urls and directories are both mapped to handlers and PerlSetVar'ed so the application can use them when needed, log formats are defined etc - separated application module (let's call it MyConfig.pm), where the things like lookup contents, default field values, customizable validation criteria or database passwords are kept I would like to integrate those two. After some initial consideration I found, that moving config from MyConfig.pm to myapp.conf does not seem to be reasonable. Imagine PerlSetVar'ing arrays and hashes which can refer one to another... Currently I think about the opposite: putting everything configurable and writing apache config in the style like: use MyConfig.pm; $PerlRequire = $MyConfig::InstallDir . '/startup.pl'; $PerlConfig .= <<"ENDCONF"; $MyConfig::accessSettings SetHandler perl-script PerlHandler myapp::Handler::Some $MyConfig::accessSettings SetHandler perl-script PerlHandler myapp::Handler::Other ENDCONF if($MyConfig::Debug) { $LogLevel = 'debug'; $PerlConfig .= "PerlWarn On\n"; } else { $LogLevel = 'warn'; } (and more, and more, the above is just a sample to show what I am thinking about, in fact most of the apache config would be done this way) The questions are: 1) As I checked, it seems that such a config would more-or-less work. But I am a bit afraid of the restart semantics. How can apache behave when graceful-ed or restart-ed having such a configuration? Would it be same or different when mod_perl is DSO'ed and when is statically linked? 2) I found that some Set*Handler directives are processed differently when specified in myapp.conf and when specified in perl with Apache->push_handlers (in particular the RestartHandler specified with push_handlers was not executed while restart although it was called on startup). Should I be afraid of anything similar after following such a config change? 3) Do you think that this is the good/bad idea from any other reasons?
[JOB SEEKER]: Looking for consulting work
Hello, mod_perl folks, I've recently decided it's time to go the consulting route and I'm looking for consulting gigs. I have quite a bit of experience with mod_perl, and Mason especially, plus database design, application design, and much more. I'm open to short or long term projects, including design, coding, code review, and training. I have a spiffy web site at http://www.houseabsolute.com/, which has more details on what I can do, as well as my resume and a list of some previous clients. Outright gifts of cash, bearer bonds, brand new cars, or other valuables are also welcome. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: Configuration in module vs in apacheconfig...
Marcin Kasperski wrote: After some initial consideration I found, that moving config from MyConfig.pm to myapp.conf does not seem to be reasonable. Imagine PerlSetVar'ing arrays and hashes which can refer one to another... If you can do it in a module, you can do it in myapp.conf. package MyConfigPackage; use vars qw($complex_var); $complex_var = { 'foo' => [ 'bar', 'baz' ] }; Personally, I've been pretty happy to keep two config files, since the distinction seems pretty clear to me. - Perrin
Re: [mp2] Apache::RequestRec, IPC::Open[23] problem
Ville Skyttä wrote: On Wed, 2003-01-22 at 08:10, Stas Bekman wrote: Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE interfaces from 1.0. Though I doubt that this will work, IPC::Open* have always had problems with mod_perl. IPC::Run should be used instead for now. Hopefully will be able to look more into this issue much later unless someone beats me to it. Thanks for the quick reply, Stas. I tried it out and that particular error is gone now, but the W3C Validator still doesn't quite work, whereas as a normal CGI it does. I didn't notice any errors, but valid pages just don't validate under mod_perl (they do as normal CGI). I know this is a too vague explanation, but I don't have time to dig deeper now. As I said, the IPC::Open* family is usually not working under mod_perl (1.0 and 2.0). Nobody has looked into resolving this issue, mainly because IPC::Run seems to be a much better alternative. But that doesn't solve the problem for those who are stuck with an existing code and aren't able to adjust it. Therefore since IPC::Run provides the same functionality and more, may be a special IPC::Open* layer can be provided which will transparently replace IPC::Open* with IPC::Run. __ 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: PerlSwitches -M and @INC
Helmut Zeilinger wrote: Hi, i am trying Apache 2.0.44 and mod_perl 1.99_08. httpd.conf :Bevor all virtual hosts PerlRequire /usr/local/apache2/conf/virtual/startup.pl The content of startup.pl is as in the mod_perl documentation including the "use Apache::compat()" directive. I one of my V-hosts i say (as described in the documentation): PerlOptions +Parent PerlSwitches -Mlib=/et/www/envirotex/lib When I start the server i get the error message: " [Wed Jan 22 13:52:07 2003] [error] Can't locate loadable object for module Apache::Constants in @INC (@INC contains: /et/www/envirotex/lib /usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/mod_perl.pm line 14 Compilation failed in require at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6. Compilation failed in require at /et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3. BEGIN failed--compilation aborted at /et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3. Compilation failed in require at (eval 1) line 3. [Wed Jan 22 13:52:07 2003] [error] Can't load Perl module Emma::AuthCookieHandler for server www.et:0, exiting... " It seems to me, that all of the Apache2 paths create by the "use Apache2" directive are no more present in the @INC Array. I tried a lot of things with several combinations of PerlSwitches (-M, -I, -Mblib, -Mlib), and startup files, but I never got the result i want: I would like to load some "private" Modules under "/et/www/envirotex/lib" and all the other things should work too. That's because you get a completely new interpreter. So you have to run Apache2 again PerlOptions +Parent PerlModule Apache2 Does that work for you? I agree that this is not-intuitive and adds to a clutter. I suppose that this should be documented for the time being. And hopefully by the time 2.0 is released we will come up with a transparent solution. Have you tried using the +Clone option instead? http://perl.apache.org/docs/2.0/user/config/config.html#C_Clone_ __ 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
Apache::SessionManager pnotes index.html problem...
Here is the simplest form of the problem I can produce. I have two handlers and want to pass some info between them visa vi pnotes. One is a PerlTransHandler for Apache::SessionManager and the other is a PerlHandler for a simple Hello.pm that dumps some html with the current _session_start value (i.e. from pnotes). Apache::SessionManager checks to see if a session file exists, creates one if not, and updates pnotes appropriately. The problem - if I request index.html there is no value in pnotes for _session_start as confirmed by Hello.pm. It seems that there is nothing in pnotes period. If after the request I manually inspect the session file created I find a value for _session_start. Request other pages (e.g. test.html) and there are expected pnotes entries confirmed by Hello.pm. Apache 1.3.27 mod_perl #START mod_perl Configuration # PerlRequire conf/startup.pl PerlSetEnv MOD_PERL_TRACE all PerlSetEnv SERVER_ROOT /usr/local/apache/ #-- #END mod_perl Configuration #START Apache::SessionManager Configuration #-- PerlModule Apache::SessionManager PerlTransHandler Apache::SessionManager # #END Apache::SessionManager Configuration #START Block Directives #-- SetHandler perl-script PerlSetVar SessionManagerDebug 0 PerlSetVar SessionManagerTracking On PerlSetVar SessionManagerExpire 3600 PerlSetVar SessionManagerStore File PerlSetVar SessionManagerStoreArgs "Directory => /usr/local/apache/session, \ LockDirectory => /usr/local/apache/session/lock" SetHandler perl-script PerlHandler MyApache::Hello SetHandler perl-script PerlHandler MyApache::Hello Alias /perl/ "/usr/local/apache/perl/" AllowOverride None Options+ExecCGI SetHandler perl-script PerlHandlerApache::Registry PerlSendHeader On # #END Block Directives package MyApache::Hello; use strict; use Apache::Constants qw(:common); sub handler { my $r = shift; $r->content_type('text/html'); $r->send_http_header; my $host = $r->get_remote_host; my $href_session = $r->pnotes('SESSION_MANAGER_HANDLE'); unless ($href_session) { print STDERR "nada\n"; } my $sess_start = $href_session->{'_session_start'}; $r->print(< Hello There Hello $host Sessoin Start: $sess_start END return OK; } 1;