CGI_GATEWAY - modperl version 2
Hi, I have probelms with modperl installation; have read through the manuals and also mailing lists but was not able to solve the probelm. Any help will be highly appreciated :) I installed modperl and apache, and configured it in httpd.conf like LoadModule perl_module modules/mod_perl.so PerlModule Apache2 Alias /perl/ /programs/apache/perl/ Location /perl/ SetHandler perl-script PerlHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location When my server starts ; I see following messages; Apache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a configured -- resuming normal operations I tried to execute perl scripts from the /perl dir and it works. But when I print the environment; the GATEWAY_INTERFACE prints CGI/1.1. I beleive something is wrong somewhere; I tried different things as mentioned in mod_perl 2 server configuration document from Apache but was not able to solve it. Following is the print of env variables; 'SCRIPT_NAME' = '/perl/test.pl', 'SERVER_NAME' = 'localhost', 'SERVER_ADMIN' = '[EMAIL PROTECTED]', 'HTTP_ACCEPT_ENCODING' = 'gzip,deflate', 'HTTP_CONNECTION' = 'keep-alive', 'REQUEST_METHOD' = 'GET', 'HTTP_ACCEPT' = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1', 'SCRIPT_FILENAME' = '/programs/apache/perl/test.pl', 'SERVER_SOFTWARE' = 'Apache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a', 'HTTP_ACCEPT_CHARSET' = 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'QUERY_STRING' = '', 'REMOTE_PORT' = '33708', 'HTTP_USER_AGENT' = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.3) Gecko/20040803', 'SERVER_PORT' = '80', 'SERVER_SIGNATURE' = 'addressApache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a Server at localhost Port 80/address ', 'HTTP_CACHE_CONTROL' = 'max-age=0', 'HTTP_ACCEPT_LANGUAGE' = 'en-us,en;q=0.5', 'REMOTE_ADDR' = '127.0.0.1', 'HTTP_KEEP_ALIVE' = '300', 'SERVER_PROTOCOL' = 'HTTP/1.1', 'PATH' = '/programs/apache/bin:/download/j2sdk1.4/bin:/bin:/download/j2sdk1.4/bin/://download/tomcat_old/bin:/programs/ant-1.6.2/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/programs/root/bin', 'REQUEST_URI' = '/perl/test.pl', 'GATEWAY_INTERFACE' = 'CGI/1.1', 'SERVER_ADDR' = '127.0.0.1', 'DOCUMENT_ROOT' = '/programs/apache/htdocs', 'HTTP_HOST' = 'localhost:80', 'MOD_PERL' = 'mod_perl/1.99_17' -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: CGI_GATEWAY - modperl version 2
[EMAIL PROTECTED] wrote: 'SCRIPT_NAME' = '/perl/test.pl', 'SERVER_NAME' = 'localhost', 'SERVER_ADMIN' = '[EMAIL PROTECTED]', 'HTTP_ACCEPT_ENCODING' = 'gzip,deflate', 'HTTP_CONNECTION' = 'keep-alive', 'REQUEST_METHOD' = 'GET', 'HTTP_ACCEPT' = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1', 'SCRIPT_FILENAME' = '/programs/apache/perl/test.pl', 'SERVER_SOFTWARE' = 'Apache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a', 'HTTP_ACCEPT_CHARSET' = 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'QUERY_STRING' = '', 'REMOTE_PORT' = '33708', 'HTTP_USER_AGENT' = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.3) Gecko/20040803', 'SERVER_PORT' = '80', 'SERVER_SIGNATURE' = 'addressApache/2.0.52 (Unix) mod_perl/1.99_17 Perl/v5.8.0 mod_ssl/2.0.52 OpenSSL/0.9.7a Server at localhost Port 80/address ', 'HTTP_CACHE_CONTROL' = 'max-age=0', 'HTTP_ACCEPT_LANGUAGE' = 'en-us,en;q=0.5', 'REMOTE_ADDR' = '127.0.0.1', 'HTTP_KEEP_ALIVE' = '300', 'SERVER_PROTOCOL' = 'HTTP/1.1', 'PATH' = '/programs/apache/bin:/download/j2sdk1.4/bin:/bin:/download/j2sdk1.4/bin/://download/tomcat_old/bin:/programs/ant-1.6.2/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/programs/root/bin', 'REQUEST_URI' = '/perl/test.pl', 'GATEWAY_INTERFACE' = 'CGI/1.1', 'SERVER_ADDR' = '127.0.0.1', 'DOCUMENT_ROOT' = '/programs/apache/htdocs', 'HTTP_HOST' = 'localhost:80', 'MOD_PERL' = 'mod_perl/1.99_17' and what's wrong about that? Tom -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: CGI_GATEWAY - modperl version 2
I tried to execute perl scripts from the /perl dir and it works. But when I print the environment; the GATEWAY_INTERFACE prints CGI/1.1. I beleive something is wrong somewhere; I tried different things as mentioned in mod_perl 2 server configuration document from Apache but was not able to solve it. http://perl.apache.org/docs/2.0/user/porting/compat.html#C__ENV_GATEWAY_INTERFACE__ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Q: how to implement a network connection per user session
Hi, I've been using Apache::Session w/ mod_perl which seems to work nicely. But I have a question -- this seems to be mostly for data. What about say a network connection (i.e. I'd like to have one connection per user session to a back-end server. The db persistent connections sort of do this I presume but they don't seem to be per session.). Thoughts? (or do I have to go the tomcat/servlet route?) Thanks, -Sundar -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Internal server error
I have an intresting problem, I have a test server running windows 2k, Activestate perl and apache 2. I have loaded the perl module mod_perl.so as well as told it to use C:/Perl/bin/perlxx.dll. In the httpd.conf I have commented out the script alias and add ExecCGI to the options, then added AddHandler cgi-script .cgi .pl to the configuration. Now when I try to run any perl script or cgi script I get an internal server error 500. With some vauge stuff in the error log that dosn't seem to be pertant at all. Ceratinaly not a cause for an internal error. Its not like the world would end if it couldn't find favico.ico. The perl script run a commandline or atleast parse. SO Im out of Ideas on waht to do. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[mp2] can't locate object method upload via package Apache::RequestRec
Forgive my poor perl and understanding of how this works! I'm trying to grab images from a form, using libapreq2, and I'm seeing this error : [Sun Nov 07 10:52:34 2004] [error] Can't locate object method upload via package Apache::RequestRec at /home/benfab/lib/BF.pm line 135.\n I've a library I'm writing, BF.pm, that has the following two subroutines in it : sub hash_post { # returns a hash of all the POST values use Apache::Request; use Apache::Upload; my ($r) = shift; my %rethash = {}; my $req = Apache::Request-new($r); my @param_names = $req-param; foreach my $value (@param_names) { $rethash{$value} = $req-param($value); } return %rethash; } sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $upload = $r-upload($name); print STDERR $upload-filename(); } They're pretty crude, but hash_post does what I need (any suggestions for improvemend gladly accepted!). I'm working on the get_uploaded_image() at the moment (as you can see, it doesn't do anything yet!) I've declared $r in my calling script, and I'm not sure if I need to declare it again in the subroutines? The calling script looks like this : my $r = Apache-request; $r-content_type(text/html); use lib qw(/home/benfab/lib); use BF; use Template; use Data::Dumper; use strict; . . . my %posted_data = BF::hash_post($r); my $upload = BF::get_uploaded_image(small_image, $BF::small_image_size, $r); If I change my subroutine to this : sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request-new($r); my $upload = $req-upload($name); print STDERR $upload-filename(); } It starts to work, but I don't understand why I need to declare $req again here? I want to keep my form parsing image stuff seperate, as not all my pages will have images to load, am I doing this the 'best' way? thanks! Carl -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] can't locate object method upload via package Apache::RequestRec
Carl Brewer wrote: sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request-new($r); my $upload = $req-upload($name); my $upload = $r-upload($name); print STDERR $upload-filename(); } They're pretty crude, but hash_post does what I need (any suggestions for improvemend gladly accepted!). I'm working on the get_uploaded_image() at the moment (as you can see, it doesn't do anything yet!) I've declared $r in my calling script, and I'm not sure if I need to declare it again in the subroutines? The calling script looks like this : my $r = Apache-request; $r-content_type(text/html); use lib qw(/home/benfab/lib); use BF; use Template; use Data::Dumper; use strict; . . . my %posted_data = BF::hash_post($r); my $upload = BF::get_uploaded_image(small_image, $BF::small_image_size, $r); If I change my subroutine to this : sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request-new($r); my $upload = $req-upload($name); print STDERR $upload-filename(); } It starts to work, but I don't understand why I need to declare $req again here? I want to keep my form parsing image stuff seperate, as not all my pages will have images to load, am I doing this the 'best' way? thanks! Carl -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] can't locate object method upload via package Apache::RequestRec
Tom Schindl wrote: Carl Brewer wrote: sub get_uploaded_image { my ($name, $max_size, $r) = @_; use Apache::Upload; my $req = Apache::Request-new($r); my $upload = $req-upload($name); I've got that in my subroutine and it works, but I'm concerned that I'm dipping into the buckets too much? Is it safe to call on $r more than once per form submission? I'm already runnign the new request() in a subroutine I call before I call the Upload one. thanks again, Carl -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Internal server error
On Thu, 4 Nov 2004, Luke wrote: I have an intresting problem, I have a test server running windows 2k, Activestate perl and apache 2. I have loaded the perl module mod_perl.so as well as told it to use C:/Perl/bin/perlxx.dll. In the httpd.conf I have commented out the script alias and add ExecCGI to the options, then added AddHandler cgi-script .cgi .pl to the configuration. Now when I try to run any perl script or cgi script I get an internal server error 500. With some vauge stuff in the error log that dosn't seem to be pertant at all. Ceratinaly not a cause for an internal error. Its not like the world would end if it couldn't find favico.ico. The perl script run a commandline or atleast parse. SO Im out of Ideas on waht to do. If this is a problem with a cgi script, or configuration, then you'll get better help in a cgi or Apache user's group. If this has to do with mod_perl specifically, then posting a minimal script illustrating the problem, along with the relevant Apache directives, would help. Also include your mod_perl/perl/Apache versions, and anything in the error log that results from running this, even if the messages look innocent. -- best regards, randy kobes -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html