1.22_01-dev: Modification of a read-only value ...
Hi, With 1.22_01-dev I got an error: [Sun Apr 2 16:50:03 2000] [error] Modification of a read-only value attempted at /usr/local/apache/lib/perl/My/ProxyRemoteAddr.pm line 15, DATA chunk 1. Here is the code: my $header = $r-headers_in-{'X-Forwarded-For'}; ^^ if ( my $ip = (split /,\s*/, $header)[-1] ) { $r-connection-remote_ip($ip); } What's wrong ? 1.22 works fine. Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
Re: [RFC] holding a mod_perl conference
On Fri, 31 Mar 2000, John D Groenveld wrote: Looks like O'Reilly is still soliciting Birds of a Feather sessions ideas for the Perl Conference 4.0. For my liver's sake, I hope there will be a mod_perl-related BOF each night. :) i suspect your liver will be well taken care of even without nightly mod_perl bofs :)
Re: [OT] I apologize
On Thu, 30 Mar 2000, J. Horner wrote: I apologize for the "me too" message. I didn't expect a Spanish Inquisition. . . . nobody ever called pablo picasso an asshole.
Re: installing with apache
At 12:51 AM 04/02/00 -0800, R Joseph Wright wrote: On Sat, 1 Apr 2000, Buddy Lee Haystack wrote: Have you had a chance to look over the excellent documentation located at [http://perl.apache.org/guide/install.html]? Yes, it's very good documentation, but nowhere do I find where it tells what line to put in httpd.conf and where. I get the sense from reading the docs that if you compile mod_perl statically into apache there is no extra configuration necessary. I just can't find it, maybe I'm too tired |-O. You don't have to turn mod_perl "on", but you do have to configure httpd.conf to use mod_perl, of course. And that's described at http://perl.apache.org/guide/config.html Bill Moseley mailto:[EMAIL PROTECTED]
Re: installing with apache
Depending on your particular setup this will probably vary a bit. I'm a RedHat user find that the mod_perl DSO module makes my life a bit easier, although a majority of mod_perl users roll their own, and swear by mod_perl's increased stability performance.;-) I checked the "Apache Bible," and you should get a good start on getting your system running by adding a couple of lines to your httpd.conf file, but use your own particular directory structure. **EDIT the "httpd.conf" file by adding the following lines... ScriptAlias /perl/ "/home/httpd/cgi-bin/" Alias /perl/ /home/httpd/cgi-bin/ Location /perl SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI /Location * I use my setup to test, so I execute both mod_perl standard perl scripts from the same CGI directory... Now, anything that is accessed as http://mysite.com/perl/perlscript.cgi will run as a mod_perl script, and anything accessed as http://mysite.com/cgi-bin/perlscript.cgi will run as a non_mod_perl script. Use this setup only if you want to test scripts as both normal cgi mod_perl scripts, otherwise you'll need to point the "Alias /perl/ /home/httpd/cgi-bin/" line "ScriptAlias /perl/ "/home/httpd/cgi-bin/" line to point to another CGI directory of your choice. Hope this helps! R Joseph Wright wrote: On Sat, 1 Apr 2000, Buddy Lee Haystack wrote: Have you had a chance to look over the excellent documentation located at [http://perl.apache.org/guide/install.html]? Yes, it's very good documentation, but nowhere do I find where it tells what line to put in httpd.conf and where. I get the sense from reading the docs that if you compile mod_perl statically into apache there is no extra configuration necessary. I just can't find it, maybe I'm too tired |-O. R Joseph Wright wrote: On Fri, 31 Mar 2000, Doug MacEachern wrote: After having compiled mod_perl and apache together, shouldn't mod_perl be enabled in httpd.conf? It isn't. Have I done things correctly? no, you need to add the mod_perl configuration to httpd.conf yourself. Then here is part II of the question: Where do I tell it to load mod_perl? I know the order in which modules are loaded is important.
AW: Installation
[...] before looking. I have followed the steps listed below and it seemed like I was not successful. How can you tell that mod_perl was loaded successfully? I am going to re-load RedHat linux 6 again but not load the server software. I will try the steps below to load apache and mod_perl. Thanks for the input. Ann. % cd /usr/src % lwp-download http://www.apache.org/dist/apache_x.x.x.tar.gz % lwp-download http://perl.apache.org/dist/mod_perl-x.xx.tar.gz % tar xzvf apache_x.x.x.tar.gz % tar xzvf mod_perl-x.xx.tar.gz % cd mod_perl-x.xx % perl Makefile.PL APACHE_SRC=../apache_x.x.x/src \ DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 % make make test make install % cd ../apache_x.x.x % make install Following the instructions in the Readme.configure of Apache you should do $ cd ../apache_1.3.X $ ./configure --prefix=/path/to/apache \ --activate-module=src/modules/perl/libperl.a \ [--enable-shared=perl] $ make $ make install instead of just % cd ../apache_x.x.x % make install Bye, Martin -- Webmaster Verlagsgruppe Deutscher Fachverlag email: [EMAIL PROTECTED]
Re: dynamically output messages on browser.
I wrote perl script to out put messages. It is supposed to output one line per 4 seconds. while loop has sleep(4), then print messages until all messages print out. But the server did not output the result per 4 seconds instead output all of results after 40 seconds How can I control that. Thanks. Apache is buffering the output. Put a "\n" at the end of your print statements and you should be okay, or an alternative would be to use $r-rflush after each print statement. -sc -- Sean Chittenden
Undefined sub problems
I get an error whenever I try to execute a handler: [Sun Apr 2 18:37:46 2000] [error] Undefined subroutine Apache::Hello::test called. The Apache::Hello is in %INC, but I can't call functions in it, even from startup.pl. Now I thought that if I managed to get it into %INC, then I could access it fine. My startup.pl looks like #!/usr/bin/perl BEGIN { use Apache (); use lib Apache-server_root_relative('lib/perl'); } use Apache::Constants (); use Apache::Registry (); use Apache::Hello (); Apache::Hello::test; 1; What might I have done wrong? S. -- Shevek GM/CS/MU -d+ H+++ s+: !g p2 au0 !a w+++ v-(---) C$ UL$ UB+ US+++$ UI+++$ P++ L$ 3+ E--- N K- !W(-) M(-) !V -po+ Y+ t+ 5++ !j !R G' !tv b+++ D++ B--- e+ u+* h++ f? r++ n y? Recent UH+++ UO+ UC++ U?+++ UV++ and collecting.
Re: Undefined sub problems
Shevek [EMAIL PROTECTED] wrote: Excuse replying to own post, I screwed up package naming and I have fixed it. %INC applies to filenames, the namespaces in packages are independent of that. -nod- On Sun, 2 Apr 2000, Shevek wrote: #!/usr/bin/perl BEGIN { use Apache (); use lib Apache-server_root_relative('lib/perl'); } use Apache::Constants (); use Apache::Registry (); use Apache::Hello (); Apache::Hello::test; 1; Btw, you probably don't need the `use lib' statement. mod_perl automatically puts $ServerRoot and $ServerRoot/lib/perl in @INC. (eagle book, pg. 500) Which raises a question for me -- if $ServerRoot is set in a Perl section, at which point does it affect @INC? I've been able to include modules in the httpd.conf file and startup.pl file that were under one of those two directories without having to `use lib'. +- James Smith - [EMAIL PROTECTED] | http://www.jamesmith.com/ [EMAIL PROTECTED] | http://sourcegarden.org/ [EMAIL PROTECTED] | http://cis.tamu.edu/systems/opensystems/ +--
Re: dynamically output messages on browser.
On Sun, 2 Apr 2000, Hui Zhu wrote: I wrote perl script to out put messages. It is supposed to output one line per 4 seconds. But the server did not output the result per 4 seconds instead output all of results after 40 seconds Set $| = 1; OT: You can do neat stuff with $| = 1 and Javascript. I wrote a CGI that does some time consuming checks and displays the results by changing the graphics on the output page with script blocks as the data comes in. Both Netscape and IE execute the scripting as soon as they receive it, rather than waiting for the page to finish loading. - Matt
Re: mod_perl DSO under Windows
On Sun, 2 Apr 2000, Paul G. Weiss wrote: I'm about to attempt to build this. How should I build Perl? In particular do I enable any of the threading or multiplicity options, and if so, which ones? My guess would be useithreads and usemultiplicity but I thought I'd ask before going down a rathole. -Paul Hi, If a primary consideration is mod_perl, and you wouldn't need the threading/multiplicity/fork options elsewhere, mod_perl works fine without these in Perl. Try the latest mod_perl cvs snapshot to build with 5.6.0. best regards, randy kobes
Error in Apache::ASP with Perl 5.6.0
Hi, I installed Apache::ASP module with Perl 5.6.0 and mod_perl 1.22 and Apache 1.3.12. When I started to use it with any file, I got the error log: " [error] Can't upgrade that kind of scalar at /usr/lib /perl5/site_perl/5.6.0/Apache/ASP.pm line 1627." I changed the "MD5"'s in ASP.pm to "Digest::MD5" (two occurrences, both at the head of the file, one is "use MD5", the other is "$MD5 = new MD5()"), then the problem disappeared. Di, Yu 4.2
Re: httpd coredumps
was everything compiled from scratch with the same compiler? Yeah, I've tried "make clean" some times. -- Tobias Brox (alias TobiX) - +4722925871 - _urgent_ emails to [EMAIL PROTECTED] Check our upcoming MMORPG at http://www.anarchy-online.com/ (Qt) and play multiplayer Spades, Backgammon, Poker etc for free at http://www.funcom.com/ (Java)
Re: Error in Apache::ASP with Perl 5.6.0
On Sun, 2 Apr 2000, Yu Di wrote: Hi, I installed Apache::ASP module with Perl 5.6.0 and mod_perl 1.22 and Apache 1.3.12. When I started to use it with any file, I got the error log: " [error] Can't upgrade that kind of scalar at /usr/lib /perl5/site_perl/5.6.0/Apache/ASP.pm line 1627." I changed the "MD5"'s in ASP.pm to "Digest::MD5" (two occurrences, both at the head of the file, one is "use MD5", the other is "$MD5 = new MD5()"), then the problem disappeared. try pre-loading Apache::ASP in httpd.conf: PerlModule Apache::ASP and/or try the cvs version of mod_perl which contains this fix: Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.445 diff -u -u -r1.445 Changes --- Changes 2000/03/30 00:44:39 1.445 +++ Changes 2000/03/30 19:35:12 @@ -10,6 +10,11 @@ =item 1.22_01-dev +reset the stack pointer after calling perl_require_module() in +perl_call_handler(). this fix will most likely cure the reports of +"Can't upgrade that kind of scalar at ..." +[Ben Cottrell [EMAIL PROTECTED]] + workaround use of Perl api functions that are no longer public with Perl 5.6.0 + win32, thanks to Randy Kobes for spotting Index: src/modules/perl/mod_perl.c === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v retrieving revision 1.110 diff -u -u -r1.110 mod_perl.c --- src/modules/perl/mod_perl.c 2000/03/30 19:34:13 1.110 +++ src/modules/perl/mod_perl.c 2000/03/30 19:35:25 @@ -1557,6 +1557,7 @@ if(stash) /* check again */ is_method = perl_handler_ismethod(stash, method); #endif + SPAGAIN; /* reset stack pointer after require() */ } if(!is_method !defined_sub) {
Re: request.t
applied to cvs, thanks Rick!
Re: 1.22_01-dev: Modification of a read-only value ...
On Sun, 2 Apr 2000, Oleg Bartunov wrote: Hi, With 1.22_01-dev I got an error: [Sun Apr 2 16:50:03 2000] [error] Modification of a read-only value attempted at /usr/local/apache/lib/perl/My/ProxyRemoteAddr.pm line 15, DATA chunk 1. hmm, 1.22_01-dev is supposed to fix that problem, does it make a difference if you backout this change? --- src/modules/perl/mod_perl.c 2000/03/31 05:16:05 1.112 +++ src/modules/perl/mod_perl.c 2000/04/03 04:19:53 @@ -1562,7 +1562,6 @@ if(stash) /* check again */ is_method = perl_handler_ismethod(stash, method); #endif - SPAGAIN; /* reset stack pointer after require() */ } if(!is_method !defined_sub) {
RE: Segmentation Fault: RedHat 6.[01] / Apache 1.3.12 / mod_perl 1.22 / perl 5.005_03 / IE 5
On Fri, 31 Mar 2000, Vivek Khera wrote: "DM" == Doug MacEachern [EMAIL PROTECTED] writes: DM mod_perl dso will do a full tear-down (perl_destruct()), regardless of DM PerlFreshRestart (which still behaves the same old way) Implying that PerlFreshRestart is ignored when mod_perl is DSO. Correct? right. If so, then it should be an error or warning to specify it when using DSO. well, it's still a FreshRestart, just fresher than static-modperl :)
Re: How do I modify the URI for standard access log?
the first patch had a copy-n-pasto, this one works fine. --- src/modules/perl/Apache.xs 2000/04/03 03:11:14 1.90 +++ src/modules/perl/Apache.xs 2000/04/03 04:32:22 @@ -1303,11 +1303,11 @@ RETVAL char * -the_request(r) +the_request(r, ...) Apache r CODE: -RETVAL = r-the_request; +get_set_PVp(r-the_request,r-pool); OUTPUT: RETVAL
Re: Segfault on DBI-Connect
On Sat, 1 Apr 2000, Valter Mazzola wrote: i've a mod_perl script that connect to a mysql db, but sometimes it segfault on DBI-connect. i'm using Apache::Registry Apache::DBI for persistend db connection, use strict and the script it's a package. i've read the docs but probably i'm missing something. if you could provide info the SUPPORT doc asks for (including stacktrace), that would help.
Re: httpd coredumps
if you could follow the hints in the SUPPORT doc for getting a stacktrace, that would help a great deal. Here we are ... hm ... it doesn't seem to tell much. The request is after the server root, and I haven't set up any perl handlers ... so then it shouldn't call perl_handler() ... or what? Program received signal SIGSEGV, Segmentation fault. 0x8081882 in perl_handler () (gdb) bt #0 0x8081882 in perl_handler () #1 0x80dbbc3 in ap_invoke_handler () #2 0x80ef579 in process_request_internal () #3 0x80ef5dc in ap_process_request () #4 0x80e6dee in child_main () #5 0x80e704c in make_child () #6 0x80e73c6 in perform_idle_server_maintenance () #7 0x80e78f5 in standalone_main () #8 0x80e7ec3 in main () #9 0x400a71eb in __libc_start_main (main=0x80e7b6c main, argc=1, argv=0xba44, init=0x807ebec _init, fini=0x81f9f7c _fini, rtld_fini=0x4000a610 _dl_fini, stack_end=0xba3c) at ../sysdeps/generic/libc-start.c:90 (gdb)
Re: Segmentation Fault: RedHat 6.[01] / Apache 1.3.12 / mod_perl1.22 / perl 5.005_03 / IE 5
On Thu, 30 Mar 2000, Robert Jenks wrote: I'm having a very strange problem. I'm running a very large application under apache/mod_perl (100+ modules; httpd children grow to 40+MB). The application uses Apache::DBI (DBD::Oracle) CGI.pm, so I have it running as a handler and everything works fine except... :) If the first request to httpd comes from IE5 to the web root, the child httpd process will segfault. However from any other client I've tried ( Netscape Comm. and "telnet 0 80 GET /" it works fine and doesn't segfault. Even stranger, if I point IE5 at "/perl-status?inc", and then at "/" it doesn't segfault (from that point forward it doesn't segfault; even if it hits a new child httpd). see the SUPPORT doc for hints on getting a stacktrace, that should help find the culprit.
Re: httpd coredumps
On Mon, 3 Apr 2000, Tobias Brox wrote: if you could follow the hints in the SUPPORT doc for getting a stacktrace, that would help a great deal. Here we are ... hm ... it doesn't seem to tell much. The request is after the server root, and I haven't set up any perl handlers ... so then it shouldn't call perl_handler() ... or what? the stacktrace looks right. it would be more useful to see the line number, which you can see if you follow this tip for building mod_perl from the SUPPORT doc: =item CORE DUMPS If you get a core dump, please send a backtrace if possible. Before you try, build mod_perl with perl Makefile.PL PERL_DEBUG=1 which will: -add `-g' to EXTRA_CFLAGS -turn on PERL_TRACE -set PERL_DESTRUCT_LEVEL=2 (additional checks during Perl cleanup) -link against libperld if it exists
Re: Segfault on DBI-Connect
Doug MacEachern [EMAIL PROTECTED] wrote: On Sat, 1 Apr 2000, Valter Mazzola wrote: i've a mod_perl script that connect to a mysql db, but sometimes it segfault on DBI-connect. i'm using Apache::Registry Apache::DBI for persistend db connection, use strict and the script it's a package. i've read the docs but probably i'm missing something. if you could provide info the SUPPORT doc asks for (including stacktrace), that would help. Definitely. I remember running into something like this before. I searched the list archives, but couldn't find it -- reminds me to make the subject meaningful :) If I remember correctly, this was a problem that could be traced to the DBD::mysql module. Specifically, the DBD::mysql::db::_login call (lines 104-160 of DBD/mysql.pm). But it's been at least half a year since then, so take this as a rough guide as to where you might want to look. +- James Smith - [EMAIL PROTECTED] | http://www.jamesmith.com/ [EMAIL PROTECTED] | http://sourcegarden.org/ [EMAIL PROTECTED] | http://cis.tamu.edu/systems/opensystems/ +--
Re: Set DocumentRoot from modperl
there have been several requests for the ability to modify the DocumentRoot, i reckon it's about time we allow that. caveats: if you want the DocumentRoot to be reset to the original value after the request is over, you'll have to do that yourself, something like: my $old_docroot = $r-document_root; $r-register_cleanup(sub { shift-document_root($old_docroot) }); the lifetime of conf-ap_document_root is longer than that of r-pool, so it can't be used to allocate the string copy. we could use the server pool, which isn't destroyed until the server is restarted, but then each time you set document_root, the server would "leak" memory. to workaround, the new document_root is saved in a Perl variable $Apache::Server::DocumentRoot --- src/modules/perl/Apache.xs 2000/04/03 04:48:52 1.92 +++ src/modules/perl/Apache.xs 2000/04/03 05:36:56 @@ -783,8 +783,26 @@ Apacher const char * -document_root(r) +document_root(r, ...) Apacher + +PREINIT: +core_server_config *conf; + +CODE: +conf = (core_server_config *) + get_module_config(r-server-module_config, core_module); + +RETVAL = conf-ap_document_root; + +if (items 1) { +SV *doc_root = perl_get_sv("Apache::Server::DocumentRoot", TRUE); +sv_setsv(doc_root, ST(1)); +conf-ap_document_root = SvPVX(doc_root); +} + +OUTPUT: +RETVAL
cvs commit: modperl Makefile.PL
dougm 00/04/02 20:49:38 Modified:.Makefile.PL Log: oops Revision ChangesPath 1.154 +1 -1 modperl/Makefile.PL Index: Makefile.PL === RCS file: /home/cvs/modperl/Makefile.PL,v retrieving revision 1.153 retrieving revision 1.154 diff -u -r1.153 -r1.154 --- Makefile.PL 2000/04/03 03:40:35 1.153 +++ Makefile.PL 2000/04/03 03:49:38 1.154 @@ -2078,7 +2078,7 @@ *) Configure Perl with -Uusemymalloc (not recommended for performance) EOF } - else { + elsif ($bincompat) { phat_warn(EOF, $abort); Your current configuration will most likely trigger core dumps, suggestions: *) Do not configure mod_perl as a DSO