Doubts
Respected Sir/Madam, We would like you to help us out in our doubts. We are working in Linux platform using Mysql as database and our scripting language is Perl. We are using Apache Web server. We have written a program in PERL to access database and fetch some records. When we execute the PERL program separately we are able to access the database and the records are fetched. But when the same perl code is called through a html page the records are not fetched. Is this problem because of some configuration not done in apache to access Mysql or is it some other problem?If we have to access Mysql through html page do we have to do any configuration on the Apache configuration files? The perl and html codes are as follows: HTML CODE:(try.html) htmlbody form action=/cgi-bin/try.pl input name=login input name=pwd input type=submit /form/body/html PERL CODE:(try.pl) == #! /usr/bin/perl print "Content-type:text/plain \n\n"; $val=$ENV{QUERY_STRING}; print "Value is : $val"; use DBI; $con=DBI-connect("DBI:mysql:$db") # where $db is the database $result=$con-prepare("select * from tab"); $result-execute; print DBI::dump_results($result); Now when we execute the perl code from the dos prompt we get the output right but when the same code is accessed through html page , though we do not get any error the database is not accessed and the records are not fetched. It would be kind of you if you would reply us what would possibly be the reason for the program not working through html page.We are online and would appreciate it if you could reply immediately to our mail. Thanks, Regards, for Treasure Solutions Software Pvt. Ltd. __ Get Your Private, Free Email at http://www.hotmail.com
Pattern Matching kills loops?
Hello everyone, Well over the past day I have been trying to debug this problem yet can't figure out a solution. Here is the problem, I am using the SSI program from the eagle book on page 94-104. Now that works fine but I have a function that is in the include file which needs to read in a config file and place its contents inside a hash. Now the problem: I open the file needed for reading and then inside the loop whenever the first match occurs the loop is for some reason the loop stops??? Now I know the code works perfectly since I have run it from a normal script and it does exactly what it is supposed to but yet under modperl for some reason it stops after the first successful match... Code in question is this unless ($fh = Apache::File-new($file)){ print STDERR "Couldn't open $file because: $!\n"; return undef; } while( $fh ){ next if /^#/; # Skip comments next if /^$/; # Skip blank lines m/(\d+):([0-9,]*):(.*)/; $id = $1; $temp = $2; $name = $3; $CAT{$id}{"name"} = $name; } close $fh; Now I have tried many variations on this, using open, placing all the file inside an array yet it still exists on the first match is made and doesn't keep processing the file If you remove all the pattern matching statements the entire file is processed like it should be. System is a stock Redhat 6.1 machine running apache 1.3.11 and modperl 1.21 Any ideas? Steve
Apache::VMonitor dumps core
Hello, Following several messages I read on this list, I have installed Apache::VMonitor (and mandatory 'other' packages) on my system, to look for an annoying memory leak on my servers. Configuration is Apache 1.3.9, mod_perl 1.21, Apache::Scoreboard 0.09, Apache::VMonitor 0.04, GTop 0.10, libgtop 1.0.6, glib 1.2.6. Maybe I forgot some other module. That running on a Linux 2.2.5-15 (almost RedHat 6.0, but with some RPMs changed for newer versions). The httpd.conf is (I erased unrelated data, to make it short) : httpd.conf ServerRoot /usr/local/apache Listen 8000 HostnameLookups off User www Group www CustomLog /home/webmaster/tests/access common ErrorLog/home/webmaster/tests/error PidFile /home/webmaster/tests/httpd.pid ScoreBoardFile /home/webmaster/tests/score LockFile/home/webmaster/tests/lock PerlRequire /home/webmaster/tests/start.pl Directory / Options None AllowOverride None order allow,deny deny from all /Directory IfDefine PERLDB Perl use Apache::DB (); Apache::DB-init; /Perl Location / PerlFixupHandler Apache::DB /Location /IfDefine Location /perl-status SetHandler perl-script PerlHandler Apache::Status order deny,allow deny from all allow from 127.0.0.1 192.168.1. /Location Location /sys-monitor SetHandler perl-script PerlHandler Apache::VMonitor allow from 127.0.0.1 /Location --- End of httpd.conf And the start.pl script is : --- start.pl #!/usr/local/bin/perl # make sure we are in a sane environment. $ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!"; use Apache::VMonitor(); $Apache::VMonitor::Config{BLINKING} = 1; $Apache::VMonitor::Config{REFRESH} = 0; $Apache::VMonitor::Config{VERBOSE} = 0; $Apache::VMonitor::Config{SYSTEM} = 1; $Apache::VMonitor::Config{APACHE} = 1; $Apache::VMonitor::Config{PROCS}= 1; $Apache::VMonitor::Config{MOUNT}= O; $Apache::VMonitor::Config{FS_USAGE} = O; $Apache::VMonitor::Config{NETLOAD} = 0; @Apache::VMonitor::NETDEVS= qw(lo eth0); $Apache::VMonitor::PROC_REGEX = join "\|", qw(httpd mysql); 1; - end of start.pl All that pretty well cut-and-pasted from docs and the like. When I access /perl-status, everything is okay. But as for /sys-monitor, I get a Segmentation Violation. Under PerlDb, this is what is printed : [www@nihao installed]$ /usr/local/apache/bin/httpd -X -DPERLDB -f /usr/local/apache/conf/httpd.small [notice] Apache::DB initialized in child 633 Loading DB routines from perl5db.pl version 1.0402 Emacs support available. Enter h or `h h' for help. Signal SEGV at /dev/null line 0 eval {...} called at /dev/null line 0 Aborted (core dumped) This is printed immediately, meaning PerlDb is not called (while it breakpoints Ok, and everything seems right, if I use the /perl-status URL). Where did I go wrong ? Tia, -- -+-+ Pierre-Yves BONNETAIN (aka Pyb) RougeBlanc - Fastest Wines in Europe. http://www.rouge-blanc.com
Apache::Request weirdness
Hello, I've discovered the following. Suggest that you use Apache::Request object in both fixup handler and registry script. So we have: 1) unpredictable segmentation faults 2) when parsing POST data, only first-time call (in fixup handler) produces correct results, the other one returns crap. Best regards, Ilya mailto:[EMAIL PROTECTED]
Re: X-Forwarded-For problem (Followup)
Thanks to Gerald Richter, Vivek Khera, and Ilya Obshadko for suggesting the solution to the X-Forwarded-For problem I was having. After a little bit of experimentation, it would appear that mod_proxy_add_forward module needs to appear before mod_proxy (and therefore be lower down Apache's execution order) in the Apache configuration. Using the ClearModuleList and AddModule directives to specify the required module order solved the problem. In hindsight, this makes a great deal of sense, especially since mod_proxy_add_forward first checks if it's dealing with a proxy request, and this can only be true if mod_proxy has had a chance to execute. Thanks again! -- // 2 Ewan Edwards {e^2} -=-=- Web Developer for CSP Internet // \\/ / mailto:[EMAIL PROTECTED]4252 Commerce Circle, Victoria, B.C., \\/ http://www.csp.net/Canada (250) 953-2680, Fax 953-2659 What is worth doing is worth the trouble of asking somebody to do.
Re: Pattern Matching kills loops?
I'm not going to respond to the general Perl question (this list isn't for that), but I have to point this out: "Steven" == Steven Clark [EMAIL PROTECTED] writes: Steven m/(\d+):([0-9,]*):(.*)/; Steven $id = $1; Steven $temp = $2; Steven $name = $3; No, no, no. NEVER look at $1 unless it is conditional based on the success of the match that should have set it. Otherwise, you get the $1 of the *previous* successful match, and many other undecipherable errors. This is OK: if (/(\d+):([0-9,]*):(.*)/) { $id = $1; $temp = $2; $name = $3; ... use variables ... } But this is probably preferred: if (($id, $temp, $name) = /(\d+):([0-9,]*):(.*)/) { ... use variables ... } -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Pattern Matching kills loops?
Whooops, Steve, I guess you should check whether your match is actually successful as in: if (/(\d+):([0-9,]*):(.*)/) { $id = $1; $temp = $2; $name = $3; $CAT{$id}{"name"} = $name; } otherwise you get whatever $1/$2/$3 happen to be before the match. Hope this helps Tobias At 09:06 PM 2/7/00 -0500, Steven Clark wrote: Hello everyone, m/(\d+):([0-9,]*):(.*)/; $id = $1; $temp = $2; $name = $3; $CAT{$id}{"name"} = $name; } close $fh; ...
Apache/mod_perl install on AIX 4.3.3 failing - maybe compiler?
I am attempting to install mod_perl 1.21 for Apache 1.3.11 on AIX 4.3.3. I am repeatedly running into the following problem when I do the configuration of Apache with mod_perl, whether attempting it as a DSO or including mod_perl in the original Apache configuration. I have checked out the FAQs and mailing lists, and I think it may be a compiler issue, but I am not sure (see below). Here is the error output: + doing sanity check on compiler and options ** A test compilation with your Makefile configuration ** failed. The below error output from the compilation ** test will give you an idea what is failing. Note that ** Apache requires an ANSI C Compiler, such as gcc. cd ..; gcc -DAIX=43 -U__STR__ -DAIX_BIND_PROCESSOR -DMOD_PERL -DUSE_PERL_SSI -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=8192 -I/u sr/local/include -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite -DNO_DL_NEEDED `./apaci` -I. -I/usr/local/lib/perl5/5.00503/aix/CORE -lm -o h elpers/dummy helpers/dummy.c -bE:/usr/local/lib/perl5/5.00503/aix/CORE/perl.exp -L/usr/local/lib /usr/local/lib/perl5/5.00503/aix/auto/DynaL oader/DynaLoader.a -L/usr/local/lib/perl5/5.00503/aix/CORE -lperl -lnsl -ldbm -ldl -lld -lm -lc -lcrypt -lbsd -lPW gcc: unrecognized option `-qmaxmem=8192' cpp: -lang-c: linker input file unused since linking not done gcc: installation problem, cannot exec `cc1': No such file or directory gcc: file path prefix `/usr/local/lib/gcc-lib/E:/usr/local/lib/perl5/5.00503/aix/CORE/perl.exp/2.95.2/' never used make: *** [dummy] Error 1 Error Output for sanity check = End of Error Report = Aborting! I also found, in the mod_perl guide, under Installation and troubleshooting, that I should check for libgdbm.so files to see if it has been installed: Missing or Misconfigured libgdbm.so On some RedHat systems you might encounter a problem during the perl Makefile.PL stage, when the installed perl was built with gdbm library, but the library isn't actually installed. If this is your situation make sure you install it, before proceeding with the build process. The problem is, I have no idea how to install the gdbm library once Perl has been built. Do I need to rebuild Perl? I am looking into this too, but I would appreciate any input. I have verified that there are no libgdbm.so files on our system, but we are not running RedHat. I was not the original builder of Perl on this system, and the original builder is off doing other things. Again, any help would be appreciated. Thanks, Jonathan
Re: Doubts
Is this problem because of some configuration not done in apache to access Mysql or is it some other problem?If we have to access Mysql through html page do we have to do any configuration on the Apache configuration files? The perl and html codes are as follows: PERL CODE:(try.pl) == #! /usr/bin/perl print "Content-type:text/plain \n\n"; $val=$ENV{QUERY_STRING}; print "Value is : $val"; use DBI; $con=DBI-connect("DBI:mysql:$db") # where $db is the database $result=$con-prepare("select * from tab"); $result-execute; print DBI::dump_results($result); You should try the script as a simple CGI. If it still fails then this is not a mod-perl issue and should be taken to a different list. That said, you need to error check your code. After your $con=DBI-connect(...); you should add defined $con or die "Error connecting to db: $DBI::errstr"; Your logs should then contain the error message of why the connect failed. I would be willing to bet this is a MySQL config issue. If its not, please don't post any follow ups to this list. Hope that helps, Joshua Joshua
mod_perl as DSO on AIX...
This message was sent from Geocrawler.com by "Mark Haviland" [EMAIL PROTECTED] Be sure to reply to that address. I'm (still) trying to compile mod_perl as a DSO on AIX. trying the flexable-way, I am able to compile and install, but upon starting the server I get: Syntax error on line 209 of /usr/hsi/apache/conf/httpd.conf: Can't locate API module structure `perl_module' in file /usr/hsi/apache/libexec/libperl.so: Function not implemented (perl_module) ./bin/apachectl start: httpd could not be started Anybody run across this ? Have any idea what it means ? I'm using: AIX 4.3.1 Apache 1.3.11 mod_perl 1.21 thanks -Mark Geocrawler.com - The Knowledge Archive
Re: Apache::Request weirdness
Ilya Obshadko wrote: Hello, I've discovered the following. Suggest that you use Apache::Request object in both fixup handler and registry script. So we have: 1) unpredictable segmentation faults I had the same problem. I think there must be some problems in libapreq (which Apache::Request uses). I was in a hurry when I ran into the problem, so I just coded around it by writing Perl equivalents of the functions I needed from Apache::Request. Eventually (in my copious spare time), I'll take some time and see if I can scrounge through a core dump to see what's going on. 2) when parsing POST data, only first-time call (in fixup handler) produces correct results, the other one returns crap. You'll get this behavior whether you're getting the POST data from Apache::Request, or just the request object's content() call. The problem is that the C API call that these functions use (ap_read_client_block, I believe) can only be called once per request. The way I've gotten around this limitation is to parse all the GET and POST data into a hash reference in the first handler, and then use the $r-pnotes method to pass the parameters from handler to handler (If you're addicted to CGI.pm, you can use the hash reference as the argument to CGI-new in your content handler and get the same results as if CGI handled the parameter parsing itself.) Good luck, -- Kevin | "Though there are ... few restrictions on the vote nowadays ... Murphy | some standards are still upheld ... at last report, the votes | from the entire God-forsaken state of Texas are still thrown, | uncounted and burning, into the River Charles." - T.H. Zweibel
Re: mod_perl as DSO on AIX...
Mark Haviland wrote: This message was sent from Geocrawler.com by "Mark Haviland" [EMAIL PROTECTED] Be sure to reply to that address. I'm (still) trying to compile mod_perl as a DSO on AIX. trying the flexable-way, I am able to compile and install, but upon starting the server I get: Syntax error on line 209 of /usr/hsi/apache/conf/httpd.conf: Can't locate API module structure `perl_module' in file /usr/hsi/apache/libexec/libperl.so: Function not implemented (perl_module) ./bin/apachectl start: httpd could not be started Anybody run across this ? Have any idea what it means ? I'm using: AIX 4.3.1 Apache 1.3.11 mod_perl 1.21 What compiler are you using? I have had problems building a nonstatic perl with gcc. Kent -- Groovy! Smashing! Yay capitalism! - Austin Powers, Man of Mystery
Re: make test fails on Embperl on AIX ...
On Mon, Feb 07, 2000 at 09:29:16PM +0100, Gerald Richter wrote: I've been trying to build HTML::Embperl on aix (4.3.1), but the make test fails I don't have any experienes with AIX, the only thing I know is what Jens Uwe wrote to me in the FAQ http://perl.apache.org/embperl/Faq.pod.1.html#Embperl_and_mod_perl_on_AIX he also sends the patches to build Embperl on AIX, maybe he (or anybody else on the list) has more ideas what's going wrong I appear to have missed the initial post, what is going wrong? -- Jens-Uwe Mager HELIOS Software GmbH Steinriede 3 30827 Garbsen Germany Phone: +49 5131 709320 FAX:+49 5131 709325 Internet: [EMAIL PROTECTED]
RE: [HTML::Embperl] Strange Error
[20011]ERR: 24: Line 13: Error in Perl code: (in cleanup) [Mon Feb 7 12:08:23 2000] PerlHandler subroutine `HTML::Embperl': Cannot access 'DESTROY' field in object of class PRCL::Player at /usr/lib/perl5/site_perl/5.005/i586-linux/HTML/Embperl.pm line 557 The page looks like: HTML HEADTITLETest/TITLE/HEAD BODY BGCOLOR=WHITE [- use PRCL::Stats; use Data::Dumper; my $stats = new PRCL::Stats("dbi:mysql:prcl", "root"); my $batter = $stats-get_batter($fdat{'id'}, '', '1997-09-28'); # The scope of my $batter ends here! -] PRE [+ Dumper $batter +] $batter is undefined here! remove the my above (if this not only a typo in your mail) I guess what confuses me is why does Embperl need access to a DESTROY field(?) in PRCL::Player? Embperl cleans up all your globals after the request, so if you have an reference to an object that is store in an global Embperl will do something like undef $batter after the request and this will (if no other reference still exists) destroy the object and therfore try to call the DESTROY method of your object, but I don't know why Perl is talking of a DESTROY field. I'm using HTML::Embperl 1.2b5. Maybe it time to upgrade? Many things has changed since 1.2b5 Gerald
Solved: Pattern Matching kills loops?
Well my saying is that everyone will be made to look like an fool at least once a week came back and bit me this week :( After posting the message I went to bed and started to think about it and consequently solved my own problem. Since I was using the SSI example from the eagle book the function which calls the functions in the include file does a local on the $/ variable effectively setting it to undef. And then of course from Programming Perl on page 184 of local "After the local is executed, but before the scope is exited, any called subroutines will see the local inner value..." Oops! So I am sorry to have wasted the bandwidth and the time of the people on the list... Steve
[modperl] Ticket examples from the Eagle book
Hi, I am desperately looking for a solution to get the ticket example from the book running. The problem seems to be that the TicketAccess module corretly creates the redirect cookie (I can see it when debugging with "x $r-err_headers_out;"), but the cookie does not seem to reach my netscape browser. When debugging the redirect in TicketMaster, the request object does not contain any cookie header fields. I have also activated cookie warning in netscape!. I have installed mod_perl with EVERYTHING=1. The same local server accept and issues tickets, so this is a real internal redirect. Seem to me that some header fields does not survive the internal redirect. When running though the login procedure, the ticket cookie is also not set. Any Ideas?? Another issue is that URI-unparse obviously does not take the server port into account. URI-port return on my host 8080, but the string returned by URI-unparse does not contain the port. Looking forward to help. Axel Wagner Biobase GmbH - Germany PS: Please CC: the answer to me personally
Re: Apache/mod_perl install on AIX 4.3.3 failing - maybe compiler?
I am attempting to install mod_perl 1.21 for Apache 1.3.11 on AIX 4.3.3.nbsp; I am repeatedly running into the following problem when I do the configuration of Apache with mod_perl, whether attempting it as a DSO or including mod_perl in the original Apache configuration.nbsp; I have checked out the FAQs and mailing lists, and I think it may be a compiler issue, but I am not sure (see below).nbsp; Here is the error output:br br font color="#FF"+ doing sanity check on compiler and optionsbr ** A test compilation with your Makefile configurationbr ** failed. The below error output from the compilationbr ** test will give you an idea what is failing. Note thatbr ** Apache requires an ANSI C Compiler, such as gcc.br br cd ..; gcc -DAIX=43 -U__STR__ -DAIX_BIND_PROCESSOR -DMOD_PERL -DUSE_PERL_SSIbr -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=8192 -I/ubr sr/local/include -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite -DNO_DL_NEEDED `./apaci`br -I. -I/usr/local/lib/perl5/5.00503/aix/CORE -lm -o hbr elpers/dummy helpers/dummy.c -bE:/usr/local/lib/perl5/5.00503/aix/CORE/perl.expbr -L/usr/local/lib /usr/local/lib/perl5/5.00503/aix/auto/DynaLbr oader/DynaLoader.a -L/usr/local/lib/perl5/5.00503/aix/CORE -lperl -lnsl -ldbm -ldl -lld -lm -lcbr -lcrypt -lbsd -lPWbr gcc: unrecognized option `-qmaxmem=8192'br cpp: -lang-c: linker input file unused since linking not donebr gcc: installation problem, cannot exec `cc1': No such file or directorybr gcc: file path prefixbr `/usr/local/lib/gcc-lib/E:/usr/local/lib/perl5/5.00503/aix/CORE/perl.exp/2.95.2/' never usedbr make: *** [dummy] Error 1br Perl is set up to use a different compiler (IBM's xlc) and the command line options are not compatible with gcc's command line options. The perl module build system remembers all compiler options used to configure perl and re-applies these upon compiling perl modules. To use modperl you must compile all parts of the equation (apache, perl, modperl other perl modules) with exactly the same compiler, that means either all IBM xlc or all gcc. Jens-Uwe Mager PS: This html thing in your email makes formatting a proper reply really difficult. HELIOS Software GmbH Steinriede 3 30827 Garbsen Germany Phone: +49 5131 709320 FAX:+49 5131 709325 Internet: [EMAIL PROTECTED]
newbie
Good Day all! I don't know if i am in the right mailing list. I am new with Perl. I need to know how to get the hard drive and removable drive information. I need to display the available storage resources. Looking forward for your helpful response. Thank you. Best Regards, Princess Marieter T. Ocampo ADTEX Philippines Inc.
Forcing user/group unto the log
Hi there, I have implemented a cookie based authentification mechanism for my website. Now I'd like to pass the user and group information in the log, both field currently show as "-" currently. Is there any simple way to do this? Thanks!
Re: Pattern Matching kills loops?
check the archives. some people were having a problem with the entire file being processed as one line instead of line by line. cliff rayman genwax.com Steven Clark wrote: I open the file needed for reading and then inside the loop whenever the first match occurs the loop is for some reason the loop stops??? Now I know the code works perfectly since I have run it from a normal script and it does exactly what it is supposed to but yet under modperl for some reason it stops after the first successful match... Code in question is this unless ($fh = Apache::File-new($file)){ print STDERR "Couldn't open $file because: $!\n"; return undef; } while( $fh ){ next if /^#/; # Skip comments next if /^$/; # Skip blank lines m/(\d+):([0-9,]*):(.*)/; $id = $1; $temp = $2; $name = $3; $CAT{$id}{"name"} = $name; } close $fh; Any ideas? Steve
[HTML::Embperl] Strange Error
I'm getting the following error from a very simple embperl page that uses a very simple module for db access: [20011]ERR: 24: Line 13: Error in Perl code: (in cleanup) [Mon Feb 7 12:08:23 2000] PerlHandler subroutine `HTML::Embperl': Cannot access 'DESTROY' field in object of class PRCL::Player at /usr/lib/perl5/site_perl/5.005/i586-linux/HTML/Embperl.pm line 557 The page looks like: HTML HEADTITLETest/TITLE/HEAD BODY BGCOLOR=WHITE [- use PRCL::Stats; use Data::Dumper; my $stats = new PRCL::Stats("dbi:mysql:prcl", "root"); my $batter = $stats-get_batter($fdat{'id'}, '', '1997-09-28'); -] PRE [+ Dumper $batter +] /PRE /BODY /HTML PRCL::Stats connects to a db. Get batter does a query and returns a PRCL::Player object which consist of the hashref returned by fetchrow_hashref. I guess what confuses me is why does Embperl need access to a DESTROY field(?) in PRCL::Player? I'm using HTML::Embperl 1.2b5. --- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems I swear I'd forget my own head if it wasn't up my ass. -- Jason Bodnar
Re: [RareModules] new Apache::Status features (Memory Usage)
I had to add a 'Use B::TerseSize' to my startup.pl in order to get the right stuff available. Otherwise, I was getting: [Mon Feb 7 12:00:38 2000] [error] Undefined subroutine B::TerseSize::package_size called at /opt/gnu/lib/perl5/site_perl/5.005/sun4-solaris/Apache/Status.pm line 375. Excellent information though. Peace.
Re: Apache::VMonitor dumps core
Following several messages I read on this list, I have installed Apache::VMonitor (and mandatory 'other' packages) on my system, to look for an annoying memory leak on my servers. Configuration is Apache 1.3.9, mod_perl 1.21, Apache::Scoreboard 0.09, Apache::VMonitor 0.04, GTop 0.10, libgtop 1.0.6, glib 1.2.6. Maybe I forgot some other module. That running on a Linux 2.2.5-15 (almost RedHat 6.0, but with some RPMs changed for newer versions). It's a problem of Apache-Scoreboard-0.09. There is some problem with API (was it changed?). It dumps core at servers() call: for (my $i=-1; $iApache::Constants::HARD_SERVER_LIMIT; $i++) { my $process = $image-servers($i); } As a temporarely solution downgrade to Apache-Scoreboard-0.08. I've checked and it works. I'll check with Doug what has happened and release an update. ___ Stas Bekmanmailto:[EMAIL PROTECTED] http://www.stason.org/stas Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC perl.apache.orgmodperl.sourcegarden.org perlmonth.comperl.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Clearing the PAD between executions.
Modperlers... I was wondering what you all thought about clearing the Cv PAD between uses. It's not currently being done, and is sort of a security concern otherwise. Of course you can argue that no one should use variables without initializing them, but people do frequently. The reason I bring this up is I'm in the process of putting together a modperl like program for phhttpd. (Like it based on that it's designed to run CGIs blazingly fast, pre-cached code, etc. Pretrials on highly trivial scripts show it's 3x faster than modperl, but that's a lie, I think 100% of that gain is due to the efficient nature of phhttpd as opposed to apache. Phhttpd!=stable, BTW) Well... if anyone is interested in the code for clearing the pad I'd be happy to send it out, or if you'd like some sample code to "show off" the problem I'd be happy to do so as well. As an aside that's really not an aside: There also appears to be a problem with fake lexicals disassociating. (i.e. ones that on the PAD are denoted as "FAKE" because they are "inherited" by a super-function) For instance: my %doggies; doSomething(); print $doggies{"great dane"}; delete %doggies; #wouldn't have to do this with cv pad clearing :) sub doSomething { $doggies{"great dane"}="big doggie"; } This doesn't *always* print out "big doggie", although it seems as though it should. It will a few times, and then start blowing chunks. (Note: didn't try this precise example, but a subset of it that had other bugs which might have tainted the result) Of course this example isn't a very good design either, I would do it differently in production code, but it's just an example to show a weakness. The possible problem with PAD clearing is that it might slow down the system, seems silly to slow the system down just to cover for sloppy programming, right? Well, I agree, this is probably true. My idea on this front is to see if it's possible to tie to these lexicals to a hash that will denote whether a lexical has been modded in the course of execution. That hash will be checked after running the program and delete all the appropriate SV's, AV's, HV's, etc. Just wanted to get your opinion since you've all been down this road, and suggest something that may be cool, or have zero merit :). Shane.
Re: Mod_Perl learning track
What magazines are good on Perl? It seems to have quite a few online and in print. Are there any that would be a waste of money? Any better for newbies or a particular use of Perl? On 4 Feb 00, at 18:29, Perrin Harkins wrote: On Fri, 4 Feb 2000, Scott Chapman wrote: What books do I need to read? There are plenty of good books on Perl, but don't neglect to read the excellent man pages. If you read all the man pages as well as The Guide at htp://perl.apache.org/guide/ you will be well on your way. - Perrin -- Scott Chapman Technical Support Specialist Lund Performance Solutions [EMAIL PROTECTED] or [EMAIL PROTECTED] Phone: 541-926-3800 www.lund.com
Re: Mod_Perl learning track
On Tue, 8 Feb 2000, Scott Chapman wrote: What magazines are good on Perl? At least two of the members on this list write for Web Techniques (Lincoln and Randal). And of course The Perl Journal is good. - Perrin
Re: Mod_Perl learning track
At 12:47 8-2-2000 -0800, Scott Chapman wrote: What magazines are good on Perl? It seems to have quite a few online and in print. Are there any that would be a waste of money? Any better for newbies or a particular use of Perl? The Perl Journal (www.tpj.com) is excellent. If you can afford it I highly recommend all the old issues as well, it really has some marvellous stuff in there - I learned a lot from it. Now if only there were more than 4 issues a year ... Grtz, Pascal -- Pascal Eeftinck - arcade^planet.nl arcade^xs4all.nl - Perl is not a language, it's a way of life
[HTML::Embperl] last and next with [$ while $]?
Is there a way to use last or next when using Embperl's built in loops and blocks. For example, I've tried something like this: [$ while $i != 10 $] [- $i++; last if $i == 5 -] [$ endwhile $] (I know it's a dumb example) But I get the following error: Can't "last" outside block. --- Jason Bodnar + [EMAIL PROTECTED] + Tivoli Systems I strive for greatness but will settle for mediocrity. -- Jason Bodnar
again coredumps with Apache 1.3.11/mod_perl 1.21 as DSO and Solaris 7
Hi, again a question about the often discussed mod_perl DSO problem. I use Apache 1.3.11, mod_ssl -2.5.0-1.3.11, ApacheJServ-1.1 and mod_perl-1.21 Using Perl 5.005_3 statically compiled (libperl.a) with: .Configure -Dprefix=/opt/perl -Dcc=/opt/SUNWspro/bin/cc -des # /opt/perl/bin/perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=solaris, osvers=2.7, archname=sun4-solaris uname='sunos hotzenplotz 5.7 generic_106541-04 sun4m sparc sun4m ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='/opt/SUNWspro/bin/cc', optimize='-O', gccversion= cppflags='-I/usr/local/include -I/opt/gnu/include' ccflags ='-I/usr/local/include -I/opt/gnu/include' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='/opt/SUNWspro/bin/cc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib' libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib -L/opt/gnu/lib' Characteristics of this binary (from libperl): Built under solaris Compiled at Nov 11 1999 20:13:12 %ENV: PERLHOME="/opt/perl" PERLLIB="/opt/mrtg/lib:/opt/rrdtool/lib/perl" @INC: /opt/mrtg/lib /opt/rrdtool/lib/perl /opt/perl/lib/5.00503/sun4-solaris /opt/perl/lib/5.00503 /opt/perl/lib/site_perl/5.005/sun4-solaris /opt/perl/lib/site_perl/5.005 on a Solaris system: hotzenplotz:jewa uname -a SunOS hotzenplotz 5.7 Generic_106541-04 sun4m sparc sun4m configuring Apache with: ./configure --prefix=/opt/apache --runtimedir=/var/httpd \ --logfiledir=/var/httpd --enable-rule=SHARED_CORE --enable-module=most --enable-shared=max \ --enable-module=ssl --enable-shared=ssl and Perl with apxs: perl Makefile.PL \ USE_APXS=1 \ WITH_APXS=/opt/apache/bin/apxs \ EVERYTHING=1 I got a: Segmentation Fault (coredump) when starting httpd - nothing new. Starting httpd with ld debug option gives: # LD_DEBUG=basic ./httpd -X 00851: 00851: calling init: /usr/lib/libc.so.1 00851: 00851: 00851: calling init: /usr/lib/libmp.so.2 00851: 00851: 00851: calling init: /usr/lib/libnsl.so.1 00851: 00851: 00851: calling init: /usr/lib/libsocket.so.1 00851: 00851: 00851: transferring control: ./httpd 00851: 00851: 00851: calling init: /usr/lib/libc.so.1 00851: 00851: 00851: calling init: /usr/lib/libmp.so.2 00851: 00851: 00851: calling init: /usr/lib/libnsl.so.1 00851: 00851: 00851: calling init: /usr/lib/libsocket.so.1 00851: 00851: 00851: transferring control: ./httpd 00851: 00851: cyclic objects for .init (Befor sorting) 00851: /opt/apache/libexec/libhttpd.so IDX=2 00851: /opt/apache/libexec/libperl.so IDX=40 00851: cyclic objects for .init (After sorting) 00851: /opt/apache/libexec/libperl.so IDX=40 00851: /opt/apache/libexec/libhttpd.so IDX=2 00851: 00851: calling init: /usr/lib/libgen.so.1 00851: 00851: 00851: calling init: /usr/lib/libcrypt_i.so.1 00851: 00851: 00851: calling init: /opt/apache/libexec/libperl.so 00851: 00851: 00851: calling init: /opt/apache/libexec/mod_jserv.so 00851: Segmentation Fault and so I 've tried: LD_PRELOAD='/opt/apache/libexec/libhttpd.so /opt/apache/libexec/libperl.so' ${APACHE_DIR}/bin/apachectl startssl which works nice. Then I 've tried to use the developer Perl version 5.005_63 because I ve read that this version should avoid the perl malloc problems but now I can't get "mod_perl" compiled: # perl -V Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration: Platform: osname=solaris, osvers=2.7, archname=sun4-solaris uname='sunos hotzenplotz 5.7 generic_106541-04 sun4m sparc sun4m ' config_args='-Dprefix=/opt/perl -Dcc=/opt/gnu/bin/gcc -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef use64bits=undef usemultiplicity=undef Compiler: cc='/opt/gnu/bin/gcc', optimize='-O', gccversion=2.95 19990728 (release) cppflags='-fno-strict-aliasing -I/usr/local/include -I/opt/gnu/include' ccflags ='-fno-strict-aliasing -I/usr/local/include -I/opt/gnu/include -DUSE_LONG_LONG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BI TS=64' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='/opt/gnu/bin/gcc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib ' libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
coderef as arg to $r-custom_response(...)
The docs hint that I can use whatever I would put after ErrorDocument as the arg to custom_response, but also suggest that I can put "a module" there. Does that mean it's the same style of argument as a -pushhandler(), where I can also put a coderef? I'm trying to write a custom Auth/Authz handler, and want to handle the failure within my module as well, sharing some variables that I've already determined during the failure. I can't output content during the Authz phase (or can I?), so I need to set up a very custom handler. Anyone done anything like this? Am I heading down a dark damp tunnel? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Apache startup problem with module DBI
Hi, I just set up mod_perl_.1.21 with apache_1.3.11 andperl 5.005_03. When trying to start the httpd server, my httpd.conf is calling a perlstartup.pl script where I get the following error. I looked in the file itself and says when finding that error it means an install error with DBI. I originally installed it right from CPAN and tried rebuilding it with make, but continue to get the error. What am I doing wrong and how may I correct this? Any help appreciated. Error message below: Can't locate loadable object for module DBI in @INC (@INC contains: /usr/lib/perl5/5.00503/i686-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i686-linux /usr/lib/perl5/site_perl/5.005 . /usr/local/apache/ /usr/local/apache/lib/perl) at /usr/lib/perl5/5.00503/DBI.pm line 158 BEGIN failed--compilation aborted at /usr/lib/perl5/5.00503/DBI.pm line 158.
Caching DBI handles with IPC?
Hi all, I've been trying cache DBI database handles using IPC::Shareable and IPC::Cache(based on ShareLite) without much luck. This is not necessarily a mod-perl problem, but I figured someone on this list must have tried this already. With either module, I get the following error message: [Tue Feb 8 16:33:34 2000] [error] Uncaught exception from user code: dbih_getcom handle 'DBI::db=HASH(0x888b458)' is not a DBI handle (has no magic) Example code for IPC::Cache $cache=new IPC::Cache({namespace='foo', expires_in=3600}); $dbh = DBI-connect('DBI:mysql:host=localhost;database=db', 'foo','bar'); $cache-set('db1', $dbh); print "dbh ping succeeded\n" if ($dbh-ping); undef($dbh); $dbh = $cache-get('db1'); print "dbh ping succeeded\n" if ($dbh-ping); Error happens after second ping. Example code for IPC::Shareable tie(%DBH, 'IPC::Shareable', 'DBHC', {create=1,destroy=0}); tied(%DBH)-shlock; $DBH{'foo'} = DBI-connect("DBI:mysql:host=localhost;database=db", "foo","bar"); tied(%DBH)-shlock; untie(%DBH); tie(%DBH, 'IPC::Shareable', 'DBHC', {create=1,destroy=0}); print "Ping succeded\n" if ($DBH{'foo'}-ping); Basically, after fetching the database handle from shared memory, it no long functions. Is this something that anybody has seen before? Thanks, -Saar Picker mongomusic.com
Re: Problems with IE5
At 12:26 PM 02/08/00 +, al wrote: The problem is this: when the line 'HTTP/1.1 403 Forbidden' is sent in the header to IE5, THAT browser thinks its a really neat idea to produce its own document from somewhere on a local Windows machine, instead of the one which I have prepared for it. End result, anyone hitting our site for the first time in a session using IE5 will be confronted with this message. Try sending more text to IE. It generates its own page if the server sends less than some small number of bytes. Bill Moseley mailto:[EMAIL PROTECTED]
mod_perl incompatibility with site control panel?
Hi there - I'm new to this list so hope I'm not "out of line" by asking the following... I recently acquired a dedicated server to run several big sites, one which required the use of mod_perl for authentication (AuthenDBI) with an mSQL database. However, I'm now informed that since we compiled mod_perl (1.21) into Apache (1.3.11) the domain site control panels for each domain no longer work (Internal Server errors). This is one of those graphical site control panels that clients can use to maintain their site (e-mail, shopping cart, mime types, etc.) My conundrum is whether to remove mod_perl so that the clients can have their control panels back or find a control panel that is compatible. Any ideas on what to expect? Can the server survive without mod_perl? Has anyone had a similar experience? Server is running Linux RedHat 6.1. I don't know the exact Control Panel software package but I've seen it before. One possible solution is to move the database over to MySQL and use mod_auth_mysql for authentication, therefore relieving the need for mod_perl. But since the sites use Perl scripts extensively, especially with database queries, will removing mod_perl create a drastic performance hit? Any help would be greatly appreciated, Brian
Re: mod_perl incompatibility with site control panel?
On Tue, 8 Feb 2000, Brian Tully wrote: However, I'm now informed that since we compiled mod_perl (1.21) into Apache (1.3.11) the domain site control panels for each domain no longer work (Internal Server errors). This is one of those graphical site control panels that clients can use to maintain their site (e-mail, shopping cart, mime types, etc.) My conundrum is whether to remove mod_perl so that the clients can have their control panels back or find a control panel that is compatible. Any ideas on what to expect? Can the server survive without mod_perl? Has anyone had a similar experience? Your scripts are probably using mod_perl, and not very happily. Run the old stuff as straight CGI, or using Apache::PerlRun instead. I would probably try Apache::PerlRun first, and if that didn't work, revert back to CGI. -- -- Tom Mornini -- InfoMania Printing and Prepress
Re: Problems with IE5
- Original Message - From: Bill Moseley [EMAIL PROTECTED] To: al [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, February 09, 2000 4:40 AM Subject: Re: Problems with IE5 Try sending more text to IE. It generates its own page if the server sends less than some small number of bytes. I think there is a user's choice: Tools Internet Options... Advanced: checkbox "Show friendly HTTP error messages"
Re: Caching DBI handles with IPC?
Saar Picker [EMAIL PROTECTED] writes: Thanks for responding. We currently are cacheing DB connections per-process. However, with 40-50 processes per server, and 4+ machines per DB server, and 3-5 connections per process, you can see how the number of connections per DB server gets rather large. I think the problem lies with the CODE references. I'll check out IPC::Shareable some more. Firstly your numbers sound a little odd, a) why do you have more than one connection per process, I assume you're using connection persistent connections of some sort (look at connect_cached for example) b) Why do you run as many as 50 processes, if you split off all the static data onto a separate server you might find things run as fast or faster with fewer processes. c) 100-200 connections might not be out of line for your database. If you're using Oracle you might check into MTS for example which can handle 1000+ connections as easily as 1 connection if they're not doing any more database work. Your problems sharing connections across sessions has nothing to do with perl. A database connection is more than just perl code, it's usually network socket and it's usually managed by a C library from the database vendor. Worse, most databases if not all databases tie the concept of session to the network connection. If two processes end up writing to the same socket the database will be very confused. In any case you can't store a socket in a shared memory segment, it's not just a piece of data. You would need to arrange to open all your sockets before Apache forked or find some other way to distribute them. Then you would need to deal with the fact that your database library stores some state information that would also need to be shared, either putting all of that in shared memory or some other way. And you don't have access to it in perl, you would need to do this in the DBD driver's C code and either use explicit support from the library or add code to the low level DB library. Then you would need to write the perl layer to handle locking the handles to avoid having two processes trying to use the same handle at the same time. In other words, there's a lot of work to be done to do this using shared memory, and not all the libraries would even support it. I'm not completely sure any of them would. DBI::Proxy works by having a single process do all the database work, everything else talks to the proxy. This adds a layer of latency though. Oracle has a native tool called Connection Manager that does something similar. -- greg
Re: Apache::Session, DBD::Oracle
On Wed, 9 Feb 2000, Robert Locke wrote: We've been using the latest Apache::Session::DBI with some success using Oracle 8i (DBD::Oracle 1.03) as the data store. (Basically, we applied Ajit Deshpande's recommendation of patching DBIStore.pm with a large number for LongReadLen. See http:[EMAIL PROTECTED] for reference.) [...] To make a long story short, it seems that storing and then fetching a binary string is broken, but I'm not sure if this is an Oracle or DBD issue, or if I'm just doing something plain silly. It's my understanding that Oracle doesn't want you to use Long anymore. They prefer BLOB for this and are phasing out Long. Maybe they broke Long in the 8i release for certain situations. BLOB works fine from DBD::Oracle, so give it a try. You may need to set the type on the bind parameter to ORA_BLOB. perldoc DBD::Oracle for the scoop. - Perrin
Re: Apache::Session, DBD::Oracle
[EMAIL PROTECTED] (Robert Locke) writes: - store this string into Oracle (type is LONG) You really really don't want to be using LONG btw. How large is the data you're really storing anyways? Oracle can do varchars up to 2k unlike some other pesky databases. LONGs have a number of problems, you can't export/import them, you can't create table as select to copy them to a new table etc. They also allegedly make your tables slow to access, though I don't know the details. I don't know if BLOBs are any different though. I do wonder whether you're making good use of your database to be storing information as frozen perl data structures. It's flexible but it can't be very fast and it doesn't buy you the data mining abilities having a database is good for. -- greg
Apache::Session, DBD::Oracle
Hi, We've been using the latest Apache::Session::DBI with some success using Oracle 8i (DBD::Oracle 1.03) as the data store. (Basically, we applied Ajit Deshpande's recommendation of patching DBIStore.pm with a large number for LongReadLen. See http:[EMAIL PROTECTED] for reference.) We recently added some more data to our session hashes and everything broke. In trying to track the problem down, we've been able to replicate it OUTSIDE of Apache by writing a Perl script which simulates Apache::Session and does the following: - create a fairly large hash - convert it to a binary string using Storable::nfreeze - store this string into Oracle (type is LONG) - fetch string from the database - compare fetched string to the original string - convert fetched string back to a hash using Storable::thaw The above works great under our development environment, where we are using Oracle 8.0.5. But, in our production environment, where we are using Oracle 8i, the fetched string differs from the original and we cannot convert it back into the original hash. To make a long story short, it seems that storing and then fetching a binary string is broken, but I'm not sure if this is an Oracle or DBD issue, or if I'm just doing something plain silly. Any pointers would be appreciated. Thanks, Rob PS. I'm attaching the code as reference. teststore.pl