cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm
stas2002/08/15 23:59:02 Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm Log: fix the notes() setting, which was broken Revision ChangesPath 1.19 +1 -1 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Index: RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- RegistryCooker.pm 16 Aug 2002 06:58:25 - 1.18 +++ RegistryCooker.pm 16 Aug 2002 06:59:02 - 1.19 -697,7 +697,7 my $class = ref $self; $self-[REQ]-log_error($$: $class: $msg); -$self-[REQ]-notes('error-notes', $msg); +$self-[REQ]-notes-set('error-notes' = $msg); $@{$self-[URI]} = $msg; }
cvs commit: modperl-2.0/ModPerl-Registry/lib/ModPerl RegistryCooker.pm
stas2002/08/15 23:59:52 Modified:ModPerl-Registry/lib/ModPerl RegistryCooker.pm Log: a nicer way to call a code ref Revision ChangesPath 1.20 +1 -1 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Index: RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- RegistryCooker.pm 16 Aug 2002 06:59:02 - 1.19 +++ RegistryCooker.pm 16 Aug 2002 06:59:51 - 1.20 -176,7 +176,7 { # run the code and preserve warnings setup when it's done no warnings; -eval { $rc = {$cv}($r, _) }; +eval { $rc = $cv-($r, _) }; $self-[STATUS] = $rc; ModPerl::Global::special_list_call(END = $package); }
cvs commit: modperl-2.0/ModPerl-Registry/t/conf modperl_extra_startup.pl
stas2002/08/16 02:01:17 Modified:ModPerl-Registry TODO ModPerl-Registry/lib/ModPerl RegistryCooker.pm RegistryLoader.pm ModPerl-Registry/t/conf modperl_extra_startup.pl Log: - getting rid of compat.pm completely, the only two missing functions, which are tmp substituted with my_finfo my_slurp_filename, will be replaced with real function when these are ported. - also make sure that everything is running under 'use strict'. - update TODO Revision ChangesPath 1.9 +5 -1 modperl-2.0/ModPerl-Registry/TODO Index: TODO === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/TODO,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TODO 15 Aug 2002 16:16:24 - 1.8 +++ TODO 16 Aug 2002 09:01:17 - 1.9 -9,13 +9,17 - consider not to use $$ in debug tracing. Not all platforms give out a different pid for different threads. +- some problems with setting the DEBUG() constant based on the value of + Apache-server-dir_config('ModPerl::RegistryCooker::DEBUG') + ### missing features ### - need to port $Apache::__T, to test against when user supplies -T flag. - port Apache::PerlRunXS -- implement slurp_filename and remove Apache::compat +- replace the local implementation of slurp_filename() and finfo(), + when these will be ported to mod_perl 2.0 - $r-chdir_file is not handled/implemented, see todo/api.txt unsafe! 1.23 +34 -10modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm Index: RegistryCooker.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- RegistryCooker.pm 16 Aug 2002 08:05:50 - 1.22 +++ RegistryCooker.pm 16 Aug 2002 09:01:17 - 1.23 -15,16 +15,21 our $VERSION = '1.99'; -use Apache::compat (); - use Apache::Response (); use Apache::RequestRec (); -use Apache::Log; -use Apache::Const -compile = qw(:common OPT_EXECCGI); -use File::Spec::Functions (); +use Apache::RequestIO (); +use Apache::Log (); +use Apache::Access (); + +use APR::Table (); + use ModPerl::Util (); use ModPerl::Global (); +use File::Spec::Functions (); + +use Apache::Const -compile = qw(:common OPT_EXECCGI); + unless (defined $ModPerl::Registry::MarkLine) { $ModPerl::Registry::MarkLine = 1; } -210,7 +215,7 my $self = shift; my $r = $self-[REQ]; -unless (-r $r-finfo -s _) { +unless (-r $r-my_finfo -s _) { $self-log_error($self-[FILENAME] not found or unable to stat); return Apache::NOT_FOUND; } -220,13 +225,13 $self-[MTIME] = -M _; unless (-x _ or IS_WIN32) { -$r-log_reason(file permissions deny server execution, +$r-log_error(file permissions deny server execution, $self-[FILENAME]); return Apache::FORBIDDEN; } if (!($r-allow_options Apache::OPT_EXECCGI)) { -$r-log_reason(Options ExecCGI is off in this directory, +$r-log_error(Options ExecCGI is off in this directory, $self-[FILENAME]); return Apache::FORBIDDEN; } -440,7 +445,7 # wasn't modified sub should_compile_if_modified { my $self = shift; -$self-[MTIME] ||= -M $self-[REQ]-finfo; +$self-[MTIME] ||= -M $self-[REQ]-my_finfo; !($self-is_cached $self-cache_table-{ $self-[PACKAGE] }{mtime} = $self-[MTIME]); } -519,7 +524,7 my $self = shift; $self-debug(reading $self-[FILENAME]) if DEBUG D_NOISE; -$self-[CODE] = $self-[REQ]-slurp_filename; +$self-[CODE] = $self-[REQ]-my_slurp_filename; } # -741,6 +746,25 Apache-warn($$: cannot find $package in cache); } } + + +# XXX: these should go away when finfo() and slurp_filename() are +# ported to 2.0 (don't want to depend on compat.pm) +sub Apache::RequestRec::my_finfo { +my $r = shift; +stat $r-filename; +\*_; +} + +sub Apache::RequestRec::my_slurp_filename { +my $r = shift; +open my $fh, $r-filename; +local $/; +my $data = $fh; +close $fh; +return \$data; +} + 1; __END__ 1.4 +15 -7 modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm Index: RegistryLoader.pm === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryLoader.pm,v retrieving revision
cvs commit: modperl-2.0/ModPerl-Registry/t/cgi-bin redirect.pl
stas2002/08/16 03:11:17 Added: ModPerl-Registry/t redirect.t ModPerl-Registry/t/cgi-bin redirect.pl Log: test external redirects Revision ChangesPath 1.1 modperl-2.0/ModPerl-Registry/t/redirect.t Index: redirect.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestUtil; use Apache::TestRequest qw(GET_BODY HEAD); plan tests = 2; my $base_url = /registry/redirect.pl; { my $redirect_path = /registry/basic.pl; my $url = $base_url?$redirect_path; ok t_cmp( ok, GET_BODY($url), test redirect: existing target, ); } { my $redirect_path = /registry/does_not_exists.pl; my $url = $base_url?$redirect_path; ok t_cmp( 404, HEAD($url)-code, test redirect: non-existing target, ); } 1.1 modperl-2.0/ModPerl-Registry/t/cgi-bin/redirect.pl Index: redirect.pl === # test env vars use Apache::URI (); my $r = shift; my $path = $r-args || ''; $server = $r-construct_server; print Location: http://$server$path\n\n;; warn Location: http://$server$path\n\n;; __END__
cvs commit: modperl-2.0/ModPerl-Registry/t/cgi-bin basic.pl closure.pl env.pl not_executable.pl require.pl special_blocks.pl
stas2002/08/16 03:11:39 Modified:ModPerl-Registry/t/cgi-bin basic.pl closure.pl env.pl not_executable.pl require.pl special_blocks.pl Log: no need for \r\n, \n is just fine Revision ChangesPath 1.2 +1 -1 modperl-2.0/ModPerl-Registry/t/cgi-bin/basic.pl Index: basic.pl === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/basic.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- basic.pl 9 Oct 2001 12:47:38 - 1.1 +++ basic.pl 16 Aug 2002 10:11:39 - 1.2 -2,7 +2,7 # test all the basic functionality -print Content-type: text/plain\r\n\r\n; +print Content-type: text/plain\n\n; print ok; __END__ 1.3 +1 -1 modperl-2.0/ModPerl-Registry/t/cgi-bin/closure.pl Index: closure.pl === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/closure.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- closure.pl15 Aug 2002 12:21:59 - 1.2 +++ closure.pl16 Aug 2002 10:11:39 - 1.3 -8,7 +8,7 # should see it under ::Registry # should not see it under ::PerlRun -print Content-type: text/plain\r\n\r\n; +print Content-type: text/plain\n\n; # this is a closure (when compiled inside handler()): my $counter = 0; 1.2 +1 -1 modperl-2.0/ModPerl-Registry/t/cgi-bin/env.pl Index: env.pl === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/env.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- env.pl9 Oct 2001 12:47:38 - 1.1 +++ env.pl16 Aug 2002 10:11:39 - 1.2 -1,6 +1,6 # test env vars -print Content-type: text/plain\r\n\r\n; +print Content-type: text/plain\n\n; print exists $ENV{QUERY_STRING} $ENV{QUERY_STRING}; __END__ 1.2 +1 -1 modperl-2.0/ModPerl-Registry/t/cgi-bin/not_executable.pl Index: not_executable.pl === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/not_executable.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- not_executable.pl 9 Oct 2001 12:47:38 - 1.1 +++ not_executable.pl 16 Aug 2002 10:11:39 - 1.2 -2,7 +2,7 # this test should return forbidden, since it should be not-executable -print Content-type: text/plain\r\n\r\n; +print Content-type: text/plain\n\n; print ok; __END__ 1.3 +1 -1 modperl-2.0/ModPerl-Registry/t/cgi-bin/require.pl Index: require.pl === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/require.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- require.pl14 May 2002 15:53:05 - 1.2 +++ require.pl16 Aug 2002 10:11:39 - 1.3 -1,6 +1,6 # test the require -print Content-type: text/plain\r\n\r\n; +print Content-type: text/plain\n\n; # XXX: fixme! #use lib qw(.); 1.5 +1 -1 modperl-2.0/ModPerl-Registry/t/cgi-bin/special_blocks.pl Index: special_blocks.pl === RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/cgi-bin/special_blocks.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- special_blocks.pl 16 Aug 2002 08:01:18 - 1.4 +++ special_blocks.pl 16 Aug 2002 10:11:39 - 1.5 -10,7 +10,7 $query = $ENV{QUERY_STRING}; } -print Content-type: text/plain\r\n\r\n; +print Content-type: text/plain\n\n; my $r = shift; our $test = $r-args || '';
Re: apache2, DBD/Oracle problem
Hi, the problem connecting to an oracle DB through mod_perl is solved: the solution was, to convert the script into a mod_perl handler as it was suggested by Stas. I adopted the code posted by Atsushi Fujita and it worked just perfect for me. So, thank you all for your help. Fredo -- Dr. Fredo SartoriTel. 030-227-55061 SPD-Fraktion im Deutschen Bundestag FAX 030-227-56169 Platz der Republik e-mail: [EMAIL PROTECTED] 11011 Berlin
Re: apache2, DBD/Oracle problem
Atsushi Fujita wrote: Hi Stas, Can you please try to convert the script into a mod_perl handler and test again? OK, I just checked it. The result was everything fine using by mod_perl handler! There was no problem in my new code. ...But I want to use ModPerl::Registry, because this is easy to migrate from normal CGI script. Please investigate the reason. I still doubt it's a registry problem. Because you've used different SetHandler's for the registry and the mod_perl handler. I bet that if you set: Location /perl SetHandler modperl ^^^ PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location it'll all work. Read: http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_2_0_Handlers and that will explain the problem. Please let us know if this was indeed the cause. __ 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: Change program name of httpd process
Stas Bekman wrote: Oleg Shaikhatarov wrote: Hello, all! I need to change proctitle (called $PROGRAM_NAME or $0 in perl) of httpd process from mod_perl. Simple change of $0 variable works well for standalone perl program, but don't work under mod_perl. I'm not sure if it's possible, but if anyone have an idea how to do this please help. please give us some more details. What do you do and what doesn't work. e.g. Apache::Registry sets $0 to the location of the currently processed script. Why cannot you do the same? Thanks for the response. I need to change program name as it seen by ps command. In other words ps ax | grep http gives something like: 21718 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21719 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21720 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 23140 pts/4S 0:00 grep http But I need this output to be: 21718 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21719 ?S 0:00 my custom title here 21720 ?S 0:00 my another custom title here 23140 pts/4S 0:00 grep http And I need to change this from mod_perl. Thanks, Oleg Shaikhatarov SWsoft Inc. __ 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: Change program name of httpd process
Oleg Shaikhatarov wrote: Stas Bekman wrote: Oleg Shaikhatarov wrote: Hello, all! I need to change proctitle (called $PROGRAM_NAME or $0 in perl) of httpd process from mod_perl. Simple change of $0 variable works well for standalone perl program, but don't work under mod_perl. I'm not sure if it's possible, but if anyone have an idea how to do this please help. please give us some more details. What do you do and what doesn't work. e.g. Apache::Registry sets $0 to the location of the currently processed script. Why cannot you do the same? Thanks for the response. I need to change program name as it seen by ps command. In other words ps ax | grep http gives something like: 21718 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21719 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21720 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 23140 pts/4S 0:00 grep http But I need this output to be: 21718 ?S 0:00 /usr/sbin/httpd -DHAVE_ACCESS -DHAVE_PROXY 21719 ?S 0:00 my custom title here 21720 ?S 0:00 my another custom title here 23140 pts/4S 0:00 grep http And I need to change this from mod_perl. I understood that. You aren't saying *where* do you need it, that's why I've asked for more details. If you want to do that for mod_perl handlers, mod_perl sets $0 to the httpd path during the perl_startup (see mod_perl.c:713). Therefore you probably want to write a PerlChildInitHandler that overrides $0. If you want the same behavior for Registry scripts, which always set $0 to the location of the currently processed script you have to subclass Apache::RegistryNG and override the method set_script_name() which does exactly that. __ 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: apache2, DBD/Oracle problem
Hi Stas, I checked using by 'SetHandler modperl', but apache responded no data without error. Apache log said HTTP response code was 200, but size was 0. 192.168.1.xxx - - [16/Aug/2002:22:01:51 +0900] GET /cgi-bin/test1.cgi HTTP/1.1 200 0 What is wrong? I still counldn't understand clearly. Thank you. Atsushi [/conf/httpd.conf] IfModule mod_perl.c PerlRequire /yopt/httpd-2.0.39_prefork_perl5.6.1normal/conf/startup.pl PerlModule ModPerl::Registry Location /cgi-bin SetHandler modperl PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location /IfModule [/conf/startup.pl] use Apache2 (); use lib qw(/yopt/httpd-2.0.39_prefork_perl5.6.1normal/cgi-bin); # enable if the mod_perl 1.0 compatibility is needed # use Apache::compat (); use ModPerl::Util (); #for CORE::GLOBAL::exit use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::Server (); use Apache::ServerUtil (); use Apache::Connection (); use Apache::Log (); use APR::Table (); use ModPerl::Registry (); use Apache::Const -compile = ':common'; use APR::Const -compile = ':common'; 1; [/cgi-bin/test1.cgi] #!/yopt/perl5.6.1normal/bin/perl use strict; use DBI; my $dsn = 'dbi:Oracle:'; my $user = 'username/password'; my $password = ''; my $dbh; my $sth; my $sql = select SEQUENCE_OWNER, SEQUENCE_NAME, LAST_NUMBER from ALL_SEQUENCES; my $rv; my @row; # print Content-type: text/html\n\n; $ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/9.0.1'; $ENV{'ORACLE_SID'} = 'ynt0'; $ENV{'NLS_LANG'}= 'japanese_japan.ja16euc'; print ORACLE_HOME=$ENV{'ORACLE_HOME'}br\n; print ORACLE_SID=$ENV{'ORACLE_SID'}br\n; print NLS_LANG=$ENV{'NLS_LANG'}br\n; print DSN=$dsn$ENV{'ORACLE_SID'}br\n; $dbh = DBI-connect($dsn$ENV{'ORACLE_SID'}, $user, $password) or die Cannot connect: .$DBI::errstr; $sth = $dbh-prepare($sql) or die Cannot prepare: .$dbh-errstr(); $rv = $sth-execute or die Cannot execute: .$sth-errstr(); print sth=$sth,rv=$rv\n; while(@row = $sth-fetchrow_array){ print @row\n; } $sth-finish(); $dbh-disconnect(); exit(0); - Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Atsushi Fujita [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, August 16, 2002 6:12 PM Subject: Re: apache2, DBD/Oracle problem Atsushi Fujita wrote: Hi Stas, Can you please try to convert the script into a mod_perl handler and test again? OK, I just checked it. The result was everything fine using by mod_perl handler! There was no problem in my new code. ...But I want to use ModPerl::Registry, because this is easy to migrate from normal CGI script. Please investigate the reason. I still doubt it's a registry problem. Because you've used different SetHandler's for the registry and the mod_perl handler. I bet that if you set: Location /perl SetHandler modperl ^^^ PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location it'll all work. Read: http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_2_0_Handlers and that will explain the problem. Please let us know if this was indeed the cause. __ 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: apache2, DBD/Oracle problem
Atsushi Fujita wrote: Hi Stas, I checked using by 'SetHandler modperl', but apache responded no data without error. Apache log said HTTP response code was 200, but size was 0. 192.168.1.xxx - - [16/Aug/2002:22:01:51 +0900] GET /cgi-bin/test1.cgi HTTP/1.1 200 0 What is wrong? I still counldn't understand clearly. because under 'SetHandler modperl' the script must be written differently. I guess the easiest is to try the other way around. Take the mod_perl handler that worked, and change it to be 'SetHandler perl-script', does it still work? Thank you. Atsushi [/conf/httpd.conf] IfModule mod_perl.c PerlRequire /yopt/httpd-2.0.39_prefork_perl5.6.1normal/conf/startup.pl PerlModule ModPerl::Registry Location /cgi-bin SetHandler modperl PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location /IfModule [/conf/startup.pl] use Apache2 (); use lib qw(/yopt/httpd-2.0.39_prefork_perl5.6.1normal/cgi-bin); # enable if the mod_perl 1.0 compatibility is needed # use Apache::compat (); use ModPerl::Util (); #for CORE::GLOBAL::exit use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::Server (); use Apache::ServerUtil (); use Apache::Connection (); use Apache::Log (); use APR::Table (); use ModPerl::Registry (); use Apache::Const -compile = ':common'; use APR::Const -compile = ':common'; 1; [/cgi-bin/test1.cgi] #!/yopt/perl5.6.1normal/bin/perl use strict; use DBI; my $dsn = 'dbi:Oracle:'; my $user = 'username/password'; my $password = ''; my $dbh; my $sth; my $sql = select SEQUENCE_OWNER, SEQUENCE_NAME, LAST_NUMBER from ALL_SEQUENCES; my $rv; my @row; # print Content-type: text/html\n\n; $ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/9.0.1'; $ENV{'ORACLE_SID'} = 'ynt0'; $ENV{'NLS_LANG'}= 'japanese_japan.ja16euc'; print ORACLE_HOME=$ENV{'ORACLE_HOME'}br\n; print ORACLE_SID=$ENV{'ORACLE_SID'}br\n; print NLS_LANG=$ENV{'NLS_LANG'}br\n; print DSN=$dsn$ENV{'ORACLE_SID'}br\n; $dbh = DBI-connect($dsn$ENV{'ORACLE_SID'}, $user, $password) or die Cannot connect: .$DBI::errstr; $sth = $dbh-prepare($sql) or die Cannot prepare: .$dbh-errstr(); $rv = $sth-execute or die Cannot execute: .$sth-errstr(); print sth=$sth,rv=$rv\n; while(@row = $sth-fetchrow_array){ print @row\n; } $sth-finish(); $dbh-disconnect(); exit(0); - Original Message - From: Stas Bekman [EMAIL PROTECTED] To: Atsushi Fujita [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, August 16, 2002 6:12 PM Subject: Re: apache2, DBD/Oracle problem Atsushi Fujita wrote: Hi Stas, Can you please try to convert the script into a mod_perl handler and test again? OK, I just checked it. The result was everything fine using by mod_perl handler! There was no problem in my new code. ...But I want to use ModPerl::Registry, because this is easy to migrate from normal CGI script. Please investigate the reason. I still doubt it's a registry problem. Because you've used different SetHandler's for the registry and the mod_perl handler. I bet that if you set: Location /perl SetHandler modperl ^^^ PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location it'll all work. Read: http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_2_0_Handlers and that will explain the problem. Please let us know if this was indeed the cause. __ 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 -- __ 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
Simple Database connect
I'm running mod_perl MySQL on a Mac OSX machine with the following information at the start of the Apache server : [Fri Aug 16 10:38:41 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [Fri Aug 16 10:38:41 2002] [notice] Apache/1.3.26 (Darwin) PHP/4.2.2 mod_perl/1.26 configured -- resuming normal operations [Fri Aug 16 10:38:41 2002] [notice] Accept mutex: flock (Default: flock) I'm trying to interface the hereafter described database with the following script : The error is at the end : could you help me to fix it (Perhaps I've made a mistake in installing manually the DBI package which is probably inside of /usr/libexec/httpd/libphp4.so) #!/usr/bin/perl # load module use DBI(); # connect my $dbh = DBI-connect(DBI:mysql:database=jobs;host=localhost, root, , {'RaiseError' = 1}); # execute query my $sth = $dbh-prepare(SELECT * FROM location); $sth-execute(); # iterate through resultset while(my $ref = $sth-fetchrow_hashref()) { print ID: $ref-{'id'}\nLocation: $ref-{'location'}\n\n; } # clean up $dbh-disconnect(); Database Description : mysql show tables; ++ | Tables_in_jobs | ++ | country| | degree | | department | | industry | | listing| | location | | r_education| | r_employment | | r_reference| | r_skill| | r_user | | salary | | subject| ++ 13 rows in set (0.00 sec) mysql select * from location; ++--+ | id | location | ++--+ | 1 | New York | | 2 | London | | 3 | Paris| | 4 | Tokyo| | 5 | Bombay | ++--+ 5 rows in set (0.48 sec) Error from error_log file : dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec [Fri Aug 16 16:28:24 2002] [error] (22)Invalid argument: getsockname Pierre Vaudrey email [EMAIL PROTECTED]
Re: DBI make apache fail in perl58.dll
I find that too ... Gerald, a little while ago, mentioned in a message to the dev list that latter DBIs work only if they come into play after the perl interpreter has been cloned - perhaps this is related to problems with using DBI in a startup script? - same from a registry script This I don't find - pulling in DBI and DBD::mysql in a registry script seems to work OK in some simple mysql queries. For this libmySQL.dll has to be in the PATH, which I often forget ... ok from a registry script, it works for me too. but with the lastest snapshot apache 2.0.40/modperl 1.99_05 DBI or any module using DBI loaded in the startup.pl makes apache segfault. doesn't it sounds like a real limitation ? best regards pascal
Re: Simple Database connect
On Friday, August 16, 2002, at 07:52 AM, Pierre Vaudrey wrote: dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec It looks as though you have some symbol conflicts between PHP and MySQL. Try turning off libphp.so. If that works, you may need to recompile PHP and/or MySQL. HTH, David -- David Wheeler AIM: dwTheory [EMAIL PROTECTED] ICQ: 15726394 http://david.wheeler.net/ Yahoo!: dew7e Jabber: [EMAIL PROTECTED]
Re: Simple Database connect
David Wheeler wrote: On Friday, August 16, 2002, at 07:52 AM, Pierre Vaudrey wrote: dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec It looks as though you have some symbol conflicts between PHP and MySQL. Try turning off libphp.so. If that works, you may need to recompile PHP and/or MySQL. most likely this: http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_exit_signal_Segmentation_fault__11___with_mysql And this: [Fri Aug 16 10:38:41 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName is amended by adding: 127.0.0.1 localhost.localdomain localhost to /etc/hosts __ 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: DBI make apache fail in perl58.dll
same here. segfault in startup.pl. not sure what version it was, but 1.30 installed DBI 1.30. no more segfault. segfault for me on win XP with DBI 1.30 if DBI is used in the startup.pl (apache 2.0.40 modperl 1.99_05 perl 5.8) I reinstalled DBI 1.30 from CPAN just in case, installs and tests ok, but the same error occurs on apache (in perl58.dll.) if module used in startup.pl and no error if use DBI from a registry script (PerlResponseHandler ModPerl::Registry) best regards pascal
win32 apache2.0.40 mod_perl-2
Hi all I upgraded from apache2.0.39 to 40 and removed, installed mod_perl-2 via ppm. NowmyApache::Registry directory is not responding. The browser just hangs. Any tips on how I can troubleshoot this? Everything isset up the way I had it workingfor2.0.39 and mod_perl-2 Thanks,paulDo You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs
mod_perl and apache's apxs
I'am very new to mod_php and here's my first question about installing mod_perl without re-configuring apache. I compiled Apache with --enable-module=so so I can compila a new version if php without building a new apache. Therefore I use ./configure --with-apxs=/usr/local/apache/bin/apxs . and everything workes fine. How can I do this with mod_perl? The first time I used the Installation commands in mod_perls README perl Makefile.PL .. and --activate-module=src/modules/perl/libperl.a Everything works fine, but something with apxs would be nicer, or?! -- Jochen Kaechelin
Re: mod_perl and apache's apxs
Jochen Kächelin wrote: I'am very new to mod_php and here's my first question about installing mod_perl without re-configuring apache. I compiled Apache with --enable-module=so so I can compila a new version if php without building a new apache. Therefore I use ./configure --with-apxs=/usr/local/apache/bin/apxs . and everything workes fine. How can I do this with mod_perl? http://www.modperlcookbook.org/chapters/ch01.pdf recipe 1.10. it's also in the guide http://perl.apache.org/docs/1.0/guide/install.html#Build_mod_perl_as_a_DSO_outside_the_Apache_Source_Tree_via_APXS --Geoff
mod_perl install problem
Hi, I've CVS'ed mod_perl-2.0, this morning Aug. 16th at about 11:00am Eastern time, and when I attempt to build with: AKIVA $ perl Makefile.PL MP_AP_PREFIX=/a3/APACHE/Apache2 MP_INST_APACHE2=1 I get: !!! You are running Perl version 5.6.0 We strongly suggest you upgrade to at least 5.6.1 Reading Makefile.PL args from ARGV MP_AP_PREFIX = /a3/APACHE/Apache2 MP_INST_APACHE2 = 1 * ERROR * Your current configuration will most likely trigger core dumps, suggestions: *) Do not configure mod_perl as a DSO *) Rebuild Perl without malloc pollution (Configure -Ubincompat5005) * ERROR * so I build with: perl Makefile.PL MP_AP_PREFIX=/a3/APACHE/Apache2 MP_INST_APACHE2=1 MP_USE_STATIC=1 everything makes ok, but when I try to install, it fails with: AKIVA $ make install cd src/modules/perl make -f Makefile.modperl cd src/modules/perl make -f Makefile.modperl install test -f mod_perl.so \ cp mod_perl.so /a3/APACHE/Apache2/modules *** Error code 1 make: Fatal error: Command failed for target `install' Current working directory /a4/WWW/APACHE2/modperl-2.0-CVS-20020816/src/modules/perl *** Error code 1 make: Fatal error: Command failed for target `modperl_lib_install' Other then the need to upgrade perl, why is the install not recognizing that mod_per..a is built and not mod_perl.so. OBTW, HTTPD-2.0 along with apr and apr-util were CVS'ed 8/15 at about 10:45am Eastern time. and compiled and installed fine. Thanks Jim Ballantine
[ANNOUNCE] StateMachine::Gestinanna 0.05
Changes: 0.05 - Added Class::Container to make creation of new state machine types (vs. applications) easier StateMachine::Gestinanna is a fairly simple state machine implementation that is driven by the application. It does not actually drive an application but provides hints as to what the application should do next. It is designed to be especially helpful in an Model/View/Controller web-application environment to help the controller decide which view should be used. However, it may also be used in other areas, such as traditional GUIs. StateMachine::Gestinanna supports both ISA and HASA inheritance of state transition definitions and code triggered by those transitions. This allows the development of classes of applications. Available on CPAN: http://www.cpan.org/modules/by-authors/id/J/JS/JSMITH/StateMachine-Gestinanna-0.05.tar.gz Available on SourceForge: http://sourceforge.net/project/showfiles.php?group_id=55902release_id=105413 -- James Smith [EMAIL PROTECTED], 979-862-3725 Senior Software Applications Developer, Texas AM CIS Operating Systems Group, Unix
Java and Perl integration
Hi, This may not be the most proper place to ask. I am just curious if there is a way to call Java (or servlet) from Perl code or such an integration project under way? Steve Lihn -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
Re: Java and Perl integration
-- Lihn, Steve [EMAIL PROTECTED] on 08/16/02 16:09:01 -0400 Hi, This may not be the most proper place to ask. I am just curious if there is a way to call Java (or servlet) from Perl code or such an integration project under way? Check the Inline module. It allows you to include Java (or C, C++, tkl, Python...) source in your Perl code. enjoi. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582
Imgae not displaying
Hello, I am using Debian woody with apache 1.3.26, perl 5.8.0and mod_perl 1.26. I have installed mod_perl succne essfully and everything is working fine except the images,css and the java script. When I checked the error log of apache I can see the following lines. Exec format error: exec of /var/www/www.abc.com/_img/rmm_white.gif failedPremature end of script headers: /var/www/www.abc.com/_img/rmm_white.gif The same thing happens also for css and js. So can anybody point out what I am missong here. Arunav Mandal.
RE: Imgae not displaying
It seems that your httpd.conf fileis configured suchthat files in /var/www/.../_img/ are interpreted as mod_perl, or some other type of script. Check yourLocation ... andAliasdirectives. You probably do not wish your images to be interpreted as scripts. Charles -Original Message-From: Arunav Mandal [mailto:[EMAIL PROTECTED]]Sent: Friday, August 16, 2002 4:31 PMTo: [EMAIL PROTECTED]Subject: Imgae not displayingImportance: High Hello, I am using Debian woody with apache 1.3.26, perl 5.8.0and mod_perl 1.26. I have installed mod_perl succne essfully and everything is working fine except the images,css and the java script. When I checked the error log of apache I can see the following lines. Exec format error: exec of /var/www/www.abc.com/_img/rmm_white.gif failedPremature end of script headers: /var/www/www.abc.com/_img/rmm_white.gif The same thing happens also for css and js. So can anybody point out what I am missong here. Arunav Mandal.
Re: Imgae not displaying
Yeah fixed it. - Original Message - From: Charles To: [EMAIL PROTECTED] Sent: Saturday, August 17, 2002 1:31 AM Subject: RE: Imgae not displaying It seems that your httpd.conf fileis configured suchthat files in /var/www/.../_img/ are interpreted as mod_perl, or some other type of script. Check yourLocation ... andAliasdirectives. You probably do not wish your images to be interpreted as scripts. Charles -Original Message-From: Arunav Mandal [mailto:[EMAIL PROTECTED]]Sent: Friday, August 16, 2002 4:31 PMTo: [EMAIL PROTECTED]Subject: Imgae not displayingImportance: High Hello, I am using Debian woody with apache 1.3.26, perl 5.8.0and mod_perl 1.26. I have installed mod_perl succne essfully and everything is working fine except the images,css and the java script. When I checked the error log of apache I can see the following lines. Exec format error: exec of /var/www/www.abc.com/_img/rmm_white.gif failedPremature end of script headers: /var/www/www.abc.com/_img/rmm_white.gif The same thing happens also for css and js. So can anybody point out what I am missong here. Arunav Mandal.
Re: DBI make apache fail in perl58.dll
pascal barbedor wrote: same here. segfault in startup.pl. not sure what version it was, but 1.30 installed DBI 1.30. no more segfault. segfault for me on win XP with DBI 1.30 if DBI is used in the startup.pl (apache 2.0.40 modperl 1.99_05 perl 5.8) I reinstalled DBI 1.30 from CPAN just in case, installs and tests ok, but the same error occurs on apache (in perl58.dll.) if module used in startup.pl and no error if use DBI from a registry script (PerlResponseHandler ModPerl::Registry) My working case is on linux, perl 5.8 with ithreads enabled, the rest is the same. Can you retrieve a backtrace from the core file? The version that I was using before 1.30 (I think it was 1.29) was blowing so badly that it was leaving no stack. __ 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: win32 apache2.0.40 mod_perl-2
Paul Simon wrote: Hi all I upgraded from apache2.0.39 to 40 and removed, installed mod_perl-2 via ppm. Now my Apache::Registry directory is not responding. The browser just hangs. Any tips on how I can troubleshoot this? Everything is set up the way I had it working for 2.0.39 and mod_perl-2 Try: http://perl.apache.org/docs/1.0/guide/debug.html#Using_the_Perl_Trace __ 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: mod_perl install problem
J. W. Ballantine wrote: [...] perl Makefile.PL MP_AP_PREFIX=/a3/APACHE/Apache2 MP_INST_APACHE2=1 MP_USE_STATIC=1 everything makes ok, but when I try to install, it fails with: AKIVA $ make install cd src/modules/perl make -f Makefile.modperl cd src/modules/perl make -f Makefile.modperl install test -f mod_perl.so \ cp mod_perl.so /a3/APACHE/Apache2/modules *** Error code 1 make: Fatal error: Command failed for target `install' Current working directory /a4/WWW/APACHE2/modperl-2.0-CVS-20020816/src/modules/perl *** Error code 1 make: Fatal error: Command failed for target `modperl_lib_install' Other then the need to upgrade perl, why is the install not recognizing that mod_per..a is built and not mod_perl.so. MP_USE_STATIC=1 is not really working yet. It builds the .a target but the build is not yet polished for this install. __ 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: DBI make apache fail in perl58.dll
On Fri, 16 Aug 2002, pascal barbedor wrote: same here. segfault in startup.pl. not sure what version it was, but 1.30 installed DBI 1.30. no more segfault. segfault for me on win XP with DBI 1.30 if DBI is used in the startup.pl (apache 2.0.40 modperl 1.99_05 perl 5.8) I reinstalled DBI 1.30 from CPAN just in case, installs and tests ok, but the same error occurs on apache (in perl58.dll.) if module used in startup.pl and no error if use DBI from a registry script (PerlResponseHandler ModPerl::Registry) Just to add one more data point - using DBI in a startup script is OK for Win32 with perl-5.6.1 and apache-2.0.40. And as with perl-5.8, it works fine in a registry script. This is also with DBI-1.30. -- best regards, randy
Re: win32 apache2.0.40 mod_perl-2
On Fri, 16 Aug 2002, Paul Simon wrote: Hi all I upgraded from apache2.0.39 to 40 and removed, installed mod_perl-2 via ppm. Now my Apache::Registry directory is not responding. The browser just hangs. Any tips on how I can troubleshoot this? Everything is set up the way I had it working for 2.0.39 and mod_perl-2 Thanks, paul In addition to what Stas suggested ... - do you mean ModPerl::Registry scripts? - do the scripts still work under ordinary cgi? - are there any useful messages in the error log? -- best regards, randy kobes
Re: win32 apache2.0.40 mod_perl-2
They do work as ordinary CGI scripts (thank goodness!). The same scripts worked under ModPerl::Registry before I upgraded everything. There are no messages in the error logs. If I call the cgi page under ModPerl::Registry via a browser, it just hangs seemingly forever... I can tryinstalling a simple hello worldhandler, skipping ModPerl::Registry, and see if that works... Thanks Randy Kobes <[EMAIL PROTECTED]>wrote: On Fri, 16 Aug 2002, Paul Simon wrote: Hi all I upgraded from apache2.0.39 to 40 and removed, installed mod_perl-2 via ppm. Now my Apache::Registry directory is not responding. The browser just hangs. Any tips on how I can troubleshoot this? Everything is set up the way I had it working for 2.0.39 and mod_perl-2 Thanks, paulIn addition to what Stas suggested ...- do you mean ModPerl::Registry scripts?- do the scripts still work under ordinary cgi?- are there any useful messages in the error log?-- best regards,randy kobesDo You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs
mod_perl recommended version matrix
Hello, Today I went to the mod_perl website with the intention of asking, what version of mod_perl works with Perl 5.8? I found that there wasn't an easy way to find this out. We seem to get a lot of questions on the list about mod_perl with Apache 2 and so forth. Perhaps it would be a good idea to have a recommended version matrix for mod_perl? For example, to indicate that mod_perl 1.27, Apache 1.3.26, and Perl 5.6.1 are a stable combination, whereas if you have Apache 2.0.40, you need mod_perl 1.99 and whichever version of Perl. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: Simple Database connect
Le vendredi 16 août 2002, à 07:17 PM, Stas Bekman a écrit : David Wheeler wrote: On Friday, August 16, 2002, at 07:52 AM, Pierre Vaudrey wrote: dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec dyld: /usr/sbin/httpd multiple definitions of symbol __dig_vec /usr/libexec/httpd/libphp4.so definition of __dig_vec /Library/Perl/darwin/auto/DBD/mysql/mysql.bundle definition of __dig_vec It looks as though you have some symbol conflicts between PHP and MySQL. Try turning off libphp.so. If that works, you may need to recompile PHP and/or MySQL. I've disabled PHP in httpd.conf and I can print the table : thanks for the tip !! most likely this: http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_exit_signal_Segmentation_fault__11___with_mysql I will do if I need in parallel PHP mod_perl And this: [Fri Aug 16 10:38:41 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName is amended by adding: 127.0.0.1 localhost.localdomain localhost to /etc/hosts I'll change the hosts file thanks. __ 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 Pierre Vaudrey 174 rue de Lyon 01800 Bourg Saint Christophe tel 0474 61 1167 mobile 0675 61 5902 email [EMAIL PROTECTED]
Re: mod_perl recommended version matrix
Andrew Ho wrote: Hello, Today I went to the mod_perl website with the intention of asking, what version of mod_perl works with Perl 5.8? I found that there wasn't an easy way to find this out. We seem to get a lot of questions on the list about mod_perl with Apache 2 and so forth. Perhaps it would be a good idea to have a recommended version matrix for mod_perl? For example, to indicate that mod_perl 1.27, Apache 1.3.26, and Perl 5.6.1 are a stable combination, whereas if you have Apache 2.0.40, you need mod_perl 1.99 and whichever version of Perl. It's not stated anywhere, because it just works. we are talking about mod_perl 1.0 here. It works with any of the perl versions 5.5-5.8. If you are talking about mod_perl 2.0, here is the info: - prefork mpm requires 5.6.0 or higher (preferrably at least 5.6.1) - threaded mpms require 5.8.0. It should be listed here: http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites I'll update it shortly. __ 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