RE: Speed of downloading problem.
Thanks Perrin, Here is the part of the httpd.conf that I believe you wanted to see. # # Apache on Win32 always creates one child process to handle requests. If it # dies, another child process is created automatically. Within the child # process multiple threads handle incoming requests. The next two # directives control the behaviour of the threads and processes. # # # MaxRequestsPerChild: the number of requests each child process is # allowed to process before the child dies. The child will exit so # as to avoid problems after prolonged use when Apache (and maybe the # libraries it uses) leak memory or other resources. On most systems, this # isn't really needed, but a few (such as Solaris) do have notable leaks # in the libraries. For Win32, set this value to zero (unlimited) # unless advised otherwise. # # NOTE: This value does not include keepalive requests after the initial # request per connection. For example, if a child process handles # an initial request and 10 subsequent keptalive requests, it # would only count as 1 request towards this limit. # MaxRequestsPerChild 0 # # Number of concurrent threads (i.e., requests) the server will allow. # Set this value according to the responsiveness of the server (more # requests active at once means they're all handled more slowly) and # the amount of system resources you'll allow the server to consume. # #ThreadsPerChild 1 # broke the IO socket #Should be on 50 like below ThreadsPerChild 50 -Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED]] Sent: Monday, February 04, 2002 10:10 AM To: Purcell, Scott; [EMAIL PROTECTED] Subject: Re: Speed of downloading problem. I have Apache/mod_perl installed on a NT box, and I am allowing customers to do downloads of High-Resolution assets. My problem is the speed of downloads is about 1/3 slower than the same box running IIS. Can you post your httpd.conf? Or at least the parts of it about threads and processes? It is possible that Apache is just not that fast on NT. NT support is experimental in the 1.3 series. One thought here was to go to 2.0 You can't run mod_perl 1.x on Apache 2.0. Another thing you could try is having multiple servers. One could handle static requests and proxy the dynamic ones to mod_perl. I don't know if IIS knows how to do this or not, but there's probably something available for NT that does it. - Perrin
Speed of downloading problem.
Hello, I have Apache/mod_perl installed on a NT box, and I am allowing customers to do downloads of High-Resolution assets. My problem is the speed of downloads is about 1/3 slower than the same box running IIS. IT dept, has confirmed that the network is not the issue, and we have ran tests for the past week. The conclusion we have drawn is for some reason, when we point to a static HTML file on the docroot of the Apache running mod-perl server that it takes 2/3 times longer to download a file than on IIS. The test is taking a 50mb file and placing it in the doc root of the IIS and Apache/htdocs. Then just having a href link pointing to it. We have ruled out the firewall and any networking. Does anyone have any clues what to try? One thought here was to go to 2.0, but we don't know if that will screw up the mod-perl that is built for the Apache 1.3.20 and Ron Savages mod_perl binary. Any info would certainly be appreciated. Scott Purcell
Multiple Sites
Hello, I have the need to create 10 web sites off my Apache web server. I do not want to use 10 IP addresses. So I am doing to cheeze and do a URL/directory/index.html foreach site. Then I would give each customer a URL of URL/directory and I would like the index.html or the default.html to come up. But it does not. I edited my conf file to this IfModule mod_dir.c #DirectoryIndex index.html DirectoryIndex default.htm /IfModule But but it does not work. But if I put in URL/directory and a forward slash/ eg. http://URL/directory/ then it shows the default.htm page. But I know my customers, and they will not put in the directory forward slash. How do I get around this issue? Thanks Scott Purcell
RE: [OT] What hourly rate to charge for programming?
What kind of thread is this? I ask a question about modperl on NT and I get riddled from the list for using NT. Then we have a thread that goes for two days about hourly charges? What's up with this ..This should be for questions about modperl. Give it a rest, I'm tired of throwing that thread away. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 10, 2001 8:41 AM To: brian moseley; [EMAIL PROTECTED] Subject: Re: [OT] What hourly rate to charge for programming? Yes, they probably have tons of experience too, which I don't have, and I'm not in Melbourne. I used to work in Melbourne and never saw any jobs for $80 - $100 per hour, apart from doctors. I'll go have another look. I need to work from home too which is a major barrier to employment. - Original Message - From: brian moseley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 10, 2001 11:18 PM Subject: Re: [OT] What hourly rate to charge for programming? On Wed, 10 Oct 2001, Gunther Birznieks wrote: At 05:14 PM 10/10/2001, [EMAIL PROTECTED] wrote: I'd like to know where I can get paid more than AU$10/hour (US$4.90 to US$5 per hour) for my mod_perl programming... You guys in America get $100US per hour?! My god, I'm in the wrong country... America is richer than Australia. gnudev, i don't know in what part of the country you're working, but i know several people in melbourne who are routinely getting paid au$80-100/hr for php, javascript/dhtml and ui design work. i haven't seen any perl work around, but then i haven't been looking either.
Virtual Host?
Hello, I have Apache w/modperl running on my NT box. The box has Samba on it, and I can see my Unix volumes from my SGI box. There is a volume there /DISK7 and I would like to be able to use that as a kind of Virtual host through the Apache Web server. /DISK7 has a bunch of .mov files that instead of copying to the htdocs directory, I would like to be able to href link to them and have them displayed. So my question is, where in the config (or how do I) configure the httpd.conf to allow me to use /DISK7 as part of the doc root? Thanks, Scott Purcell
nph- in url on NT gives error
Hello, I was trying to do an exercise from TPJ Issue#5 (vol2.,no2) Rating Web Page Tastefulness with a Perl Agent, and it uses nph- in the URL. (Steins column). Anyway, I am running Apache 1.3.20 and just began coding a few lines. I noticed errors in the log file: couldn't spawn child process: /apache/cgi-bin/nph-rater.cgi So I began trying to iron out what is wrong, and I noticed that if I take the same code and rename it to test.cgi it is happy. So apparently it is telling me that I cannot do non-parsed headers on Apache running NT? The code (couldn't be any simpler) errors when named 'nph-rater.cgi', but runs with no issues if I rename that same bit of code to 'test.cgi'. #! D:\\Perl\\bin; use CGI; # load CGI routines $q = new CGI;# create new CGI object print $q-header,# create the HTTP header $q-start_html('hello world'), # start the HTML $q-h1('hello world'), # level 1 header $q-end_html; # end the HTML Scott Purcell
Socket Nightmare On NT.
Hello, I am running mod_perl 1.2 on NT. I have been working with it for over 4 months, and am beginning to understand it. But for the past 4 months, I have complained about a socket problem using IO socket. The only answer I got was to turn the max child from 50 to 1. When I do that the IO::Socket module works. But the site runs in a serial mode. Why use mod_perl then? It is slower than running on a Macintosh. Anyway, I have to talk sockets for my product to work. The code below works under cgi-bin all day long. But as I said it blows up (works once) under mod_perl. Is there anything I can do to get the sockets to work under mod_perl? Or should I go back to cgi-bin applications? I am at the end of my rope and could use some sound information. Anyone out there lend a hand? Thanks, Scott Purcell ### simple socket code ### #! perl use CGI; use CGI::Carp qw/fatalsToBrowser/; my $q = new CGI; print $q-header(); print $q-start_html(HELLO); use IO::Socket; $socket = IO::Socket::INET-new(PeerAddr = 'xxx.238.162.xxx', PeerPort = '9000', Proto= 'tcp') or die(No connect iosocket. $@\n); my $username = 'VBO'; my $password = 'VBO'; open (ISCRYPT, d:/Apache/mod_perl/vb/iscrypt \$password\ |) or die(Cannot encrypt password for verification.); my @password = ISCRYPT; my $ePassword = $password[0]; close ISCRYPT; $message = 999\tUSERLOGIN\t$username\t$ePassword\n; my $msgsize = length($message); print $socket \%BEGIN\t$msgsize\n$message\n; print Message to $productName :\npre$message/pre\n\n; GetMessage($socket); sub GetMessage { my $fh = shift; my $err = 0; my $header; my $response; while ($err 50) { if (read($fh, $cc, 1, 0) == 1) { $header .= $cc; print $headerbr\n; if ($header =~ /^\%BEGIN\s+(\d+)\r?\n/) { # we've acquired one line's worth of response my $rspsize = $1; # how much response to read if (read($fh, $response, $rspsize, 0)) { if ($response =~ /RESPONSE\s*OK/) { print $response is responsebr\n; return (1, $response); } else { return (-1, $response); } } else { return 0; } } elsif ($header =~ /\%CONTINUE\s*\r?\n/ || $header =~ /\%END\s*\r?\n/) { undef $header; } elsif ($header =~ /\n$/) { squawk(unknown mediabank response: $header); return -1; } else { # keep going haven't hit a newline yet } $count++; } else { $err++; } } return 0; } close ($socket); undef ($socket);
RE: Apache::Reload???
Does that work under Unix only? I am on NT and it does not appear to work. Can someone clarify. Thanks Scott -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 9:38 PM To: Bryan Coon Cc: Matt Sergeant; '[EMAIL PROTECTED]' Subject: Re: Apache::Reload??? On Tue, 31 Jul 2001, Bryan Coon wrote: I must have missed something in setting up Apache::Reload. What I want is simple that when I make a change in my scripts I dont have to restart the Apache server... I put PerlInitHandler Apache::Reload in my httpd.conf, and added 'use Apache::Reload' to the modules that I want to be reloaded on change. But I get the following warning message in my apache logs: Apache::Reload: Can't locate MyModule.pm for every module I have added Apache::Reload to. How do I do this so it works? The docs on Reload are a bit sparse... Your problem probably comes from the fact that @INC is reset to its original value after its get temporary modified in your scripts. Of course when Apache::Reload tries to find the file to test for its mod time, it cannot find it. The solution is to extend @INC at the server startup to include directories you load the files from which aren't in @INC. For example, if you have a script which loads MyTest.pm from /home/stas/myproject: use lib qw(/home/stas/myproject); require MyTest; Apache::Reload won't find this file, unless you alter @INC in startup.pl: startup.pl -- use lib qw(/home/stas/myproject); and restart the server I'll add these notes to the guide. Matt probably wants to add these to the Apache::Reload docs as well :) _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
RE: Newbie question
Yes, Go to Ron Savages site. He has a binary build of Apache + mod_perl and also the latest perl. http://www.savage.net.au go to the navigation and press on Perl, and look under Perl Modules and look three bullet items down ... It is there. Follow along. I have used it twice and it gets you operational in about an hour. Yell if you have any questions, as I have done this twice on NT. Scott -Original Message- From: Randy Kobes [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 10:20 AM To: Jason Cc: [EMAIL PROTECTED] Subject: Re: Newbie question On Thu, 12 Jul 2001, Jason wrote: Sorry if this is in an FAQ somehere (googled for it, but no luck). Does anyone know of a *good* guide to compiling/configuring/installing Apache + mod_perl on a Windows NT system? INSTALL.win32 in the mod_perl sources describes how to build and install mod_perl - this is geared towards using VC++. As for configuring, if you have Apache set up already, the configuration and use is very similar to Unix - see http://take23.org/ and http://perl.apache.org/, especially the guide, for lots more info on that. There's a sample Win32 httpd.conf at http://theoryx5.uwinnipeg.ca/ppmpackages/httpd.conf-perl that contains a number of common directives used for mod_perl related things. The impression I get from scouting newsgrops is that most people resort to using a prebuild binary - so I figure it must be tricky? No, not really - the build process differs from Unix, but after that, and taking into account the differences in general with Perl/Apache on Win32, it's relatively straightforward to use. best regards, randy kobes
RE: re rand bug?
Sorry to be confused, but I believe I did not create a global variable. In the code below that I showed, I used a my to localize the $tmp variable inside the for loop.? Anyway, I changed the simple code and added the use strict and use vars qw($rand), but now I get no random activity at all. Each time a user hits it, they of course receive the same 4 numbers. Not very random I am sure I am screwing this up somehow, was anyone able to get this to work, or able to get 4 random numbers each time they run the snippet of code? Thanks Scott -Original Message- From: Gunther Birznieks [mailto:[EMAIL PROTECTED]] Sent: Friday, July 06, 2001 6:22 PM To: Purcell, Scott; '[EMAIL PROTECTED]' Subject: Re: rand bug? Your problem is likely that the use of a global my is creating a closure (see mod_perl guide). Replace it with use vars qw($rand); and don't declare your globals using my. At 01:07 PM 7/6/2001 -0500, Purcell, Scott wrote: Hello, rand bug with mod_perl? my $rand = int(rand(1000)) always produces '2' under mod_perl. I have noticed that if I ask for the line above, it always puts $rand at a '2'? So I did some test below, looping through and the first time through with mod_perl, the number is always 2? Under investigation when I run the following code under cgi-bin, it works good like it should. 960 is tmp 240 is tmp 193 is tmp 197 is tmp When I run that same code under mod_perl, it looks like this: 2 is tmp 564 is tmp 194 is tmp 809 is tmp So basically if I just need one random number I have to do some excess work? Does anyone know why this is? If anyone wants just drop the following line under cgi-bin and mod_perl and you'll see the results. Please let me know, Scott #! perl use CGI qw/:standard/; my $q = CGI-new; print $q-header(); print $q-start_html(hello); foreach (my $i=1; $i5; $i++) { my $tmp = int(rand(1000)+1); print $tmp is tmpbr\n; } Scott Purcell __ Gunther Birznieks ([EMAIL PROTECTED]) eXtropia - The Open Web Technology Company http://www.eXtropia.com/
Tutorials Need To Learn More
Hello, I am working with mod_perl and apache on NT (No ripping please ... it is a political issue here at my work.). Anyway, I have been trying to learn more about taking advantage of handlers, etc. I purchased the book Writing Apache Modules with Perl and C, but it is NOT NT friendly. Most of the examples DO NOT work on my NT mod_perl. Anyway, I figure there has to be more resources than just that book. Does anyone know of any? I am looking for examples and techniques to get me rolling. Thanks, Scott Purcell
rand bug?
Hello, rand bug with mod_perl? my $rand = int(rand(1000)) always produces '2' under mod_perl. I have noticed that if I ask for the line above, it always puts $rand at a '2'? So I did some test below, looping through and the first time through with mod_perl, the number is always 2? Under investigation when I run the following code under cgi-bin, it works good like it should. 960 is tmp 240 is tmp 193 is tmp 197 is tmp When I run that same code under mod_perl, it looks like this: 2 is tmp 564 is tmp 194 is tmp 809 is tmp So basically if I just need one random number I have to do some excess work? Does anyone know why this is? If anyone wants just drop the following line under cgi-bin and mod_perl and you'll see the results. Please let me know, Scott #! perl use CGI qw/:standard/; my $q = CGI-new; print $q-header(); print $q-start_html(hello); foreach (my $i=1; $i5; $i++) { my $tmp = int(rand(1000)+1); print $tmp is tmpbr\n; } Scott Purcell
Apache V2 and Mod_Perl Question
Hello, NT question. I believe that Apache 2 is out for NT, and was wondering if apache 2 works with mod_perl? I am running Apache 1.3.20 and mod_perl 1.25_01-dev. Can or should we start converting to Apache 2? Just curous about some time frames for this. Thanks Scott Purcell
Startup.pl File Q
Mod_perl version: 1.25_01-dev Perl version: 5.6.1 Apache Version: 1.3.20 OS:NT I am in the apache book and I am doing some hacking. In my startup.pl file, I put 'use CG qw(:standard); along with some other modules. Anyway, then I typed that little dittie below, and commented out the $use CGI (since I thought it would be loaded in the startup.pl file). It does not work. Are the items in the startup.pl file only used with handlers? Thanks Scott ### code below just for reference # #! /usr/local/bin/perl #use CGI qw(:standard); use strict; my $name = param('name') || 'Anonymous'; print header(), start_html(-title='Yo!',-bgcolor='blue'), h1(Hello $name), p( To change your name, enter it into the text field below and press, em(change name.) ), start_form(), Name: ,textfield(-name='name',-value='Anonymous'), submit(-value='Change Name'), end_form(), hr(), end_html(); Scott Purcell
StatINC Reload on NT
I have begun development on a new project and I am using Apache on NT with mod_perl. I have created a lot of modules and I am using them in my code. The problem is that as I continue to develop, some modules keep changing, and I am getting tired of restarting the server. I have read the mod_perl Coding guidelines three times now. Under the coding guidelines it has the example of using Apache::StatINC. I followed it the instructions exactly, but yet, it does NOT work. After that I tried Apache::Reload both ways with no success. Has anyone out there got either of these working on NT? I do not want to use work-arounds on this large project. I really need to have the ability to reload these modules on each hit to the server while developing the core code set. I even have the apache book, but I can't find any mention of this there either. Please advise. Scott Purcell
Reload Modules on NT Apache
Hello, I am using mod-perl, and I am in the development stages of coding. Each time I make a code change to a module, I must restart apache. I know there must be docs for this, but I cannot find them from the apache web site. Could someone assist me in finding those? Or if someone knows of a simple way to accomplish this task, please advise. Thanks Scott Purcell
mod_perl install
Hello, I am trying a new install of mod_perl on my NT box here which is running apache. The last install I used Ron Savages NT binary distribution. And it was easy to install and worked. But I feel that I need to install mod_perl from scratch (I have to begin supporting it here at my shop). I downloaded the cpan package, gziped and extracted tar. The install directions for NT look a little gray. Maybe there is a step by step guide somewhere? If anyone knows I would appreciate. Thanks Scott Purcell
Curious About Require
Hello, I have a question about require when using mod-perl. I produced four simple .pl files. main.pl, one.pl two.pl three.pl From the main.pl you can link to either one two or three.pl. Pretty simple. The problem begins when I put a require in one.pl, two.pl, and three.pl. If in each of those files I put in for instance: require D:/Apache/mod_perl/query.pl; When I click on the main, and lets say I go to one.pl it works fine. If I then proceed to click on two.pl (it says query.pl not found), even though there is a require. Restart Apache, Then click from main to two.pl it works fine. If then I go to one.pl error (it says query.pl not found). So my question is why this bazaar behavior. If I change the query.pl to a module and use it in each of the pages it is fine. I just find this behavior rather funny. If anyone has any insight please update me. Thanks, Scott Purcell
ModPerl package Q
Hello, Well, this is the last time I am going to bring this up. I am on Apache NT, and I have the following .pm file that I believe I localized everything in order to create a socket. The code below does work. But it never makes a new socket. As you can see I print out the IO::Socket::GLOB and it shows the same 'reference' 10xff036c each time through. I realize this is because I am not closing and undef the $sock. (see the commented close and undef towards the end). But this works. Except if I shut down the machine I am calling the socket on. Then it dies and never comes back unless I reboot apache. Not a good work position to get a web site into. But here is the catch. If I do close the socket and either undef or even leave that commented out, I only get one send to the socket, and one reply, but it never sends another reply to the server and never gets another response back? But yes, it creates a new socket ref each time? This confuses me so. If I close the socket, then it shows that I am creating a new socket, but it never sends or gets a new response. But the rest of the behavior is proper. I was just hoping someone could look below, see if they see anything obviously wrong and reply, or else I am left to believe that this is possibly a threading issue with the sockets on NT? I am going to switch to ActiveStates plex, but still would like to continue striving towards getting the apache running with this code. So there is no rush on this, it just makes no sense, and I hate to leave open-ended issues. Thanks for your time, Scott package q2; use IO::Socket; my $sock; sub tryQuery { unless ($sock) { print No sock making itbr\n; $sock = IO::Socket::INET-new(Proto = 'tcp', PeerAddr = '208.238.162.204', PeerPort = '8000') or die (@!); $sock-autoflush(1); } my ($querystring,$fieldlist,$dbpathlist,$type) = @_; print $querystring is QSbr\n; print $fieldlist is FLbr\n; print $dbpathlist is DBbr\n; print $typeis TPbr\n; my $message = DBASEQUERY\n$type\n$querystring\nLIST\tFIELDS\n$fieldlist\nENDLIST\nLIST\tD BASES\n$dbpathlist\nENDLIST\n; ask($message); } sub ask { my $message = shift; print $message is our messagebr\n; my $msgid = int(rand(1000)); $message = $msgid . \t . $message; my $msgsize = length($message); print here is our line . $sock . \%BEGIN\t$msgsize\n$message SHOIULD BE GOLDEN; print $sock \%BEGIN\t$msgsize\n$message; my $result = $sock; print $result is first result from Qbr\n; my $response; $result =~ s/\D//g; print $result is should now be digitsbr\n; print $sock is our sockbr\n; read($sock, $response, $result); print $response is our responsebr\n; #close($sock); # undef $sock; } 1; Scott Purcell
Socket On NT Resolved
Hello, Well after two weeks of posting that socket issue up on this site, one member came forward with the following info: Set in httpd.conf ThreadsPerChild 1 This problem should go away. Its a bug I ran into for the first time a few years back, and seems to have to do with any network sockets that you might open. See http://forum.swarthmore.edu/epigone/modperl/crestehtwimp/35970707.7BBCB1F4@a lumni.stanford.org for my original post on this, showing our similar plights! This fixed the problem, so maybe the next guy that runs into this won't have to go through the same issues as I had. Scott Purcell
Web Site Question
Hello, First: I am running apache/mod-perl on a NT box as a web server. Sorry it is not unix, it is the only tool I can have. Kind of a forward question, but I am curious about something. My large web site talks to a back-end product that uses an API and I use the IO::Socket to talk to it. It is a pure socket application. It takes the place of a database back-end. So my question is, should I create a global socket handle, and then use it all the time, or is it best to just call for the handle each time I need request some data? The reason I ask is as follows: I have the code below which works, but I cannot seem to ask two socket calls back to back? I don't know why. Maybe it is a learning curve I have to perfect. Anyway, I figured I would ask people who would know for their input. So if anyone has any opinions, could you fill me in? Thanks for your time, Scott Purcell code that works, called from another file with a ask routine. use strict; use vars qw($socket); $socket = IO::Socket::INET-new(Proto = 'tcp',PeerAddr = '208.238.162.204',PeerPort = '8000') or die (Socket issue @!); $socket-autoflush(1); sub ask { ### perl apache notes for my sanity during testing my $counter = 0; for (1..5) { increment_counter(); } sub increment_counter{ $counter++; print Counter is equal to $counter !\r\n; } end counter eg for sanity use IO::Socket; use CGI; use CGI::Carp qw(fatalsToBrowser); # my $q = CGI-new; print $q-header; print $q-start_html; my $querystring = \' \'\$USER_NAME; my $fieldlist = USER_NAME\nPASSWORD\n; my $db = /DISK2/VBank/bin/sysdbase/dbuser.dbf; my $message = DBASEQUERY\nSYSTEM\n$querystring\nLIST\tFIELDS\n$fieldlist\nENDLIST\nLIST\t DBASES\n$db\nENDLIST\n; my $msgid = int(rand(1000)); $message = $msgid . \t . $message; my $msgsize = length($message); print $message IS OUR MESSAGEBR\n; print $socket \%BEGIN\t$msgsize\n$message; my $err = 0; my $header; my $response; my $cc; while ($err 50) { if (read($socket, $cc, 1, 0) == 1) { $header .= $cc; print $header is headerbr\n; if ($header =~ /^\%BEGIN\s+(\d+)\r?\n/) { my $rspsize = $1; read($socket, $response, $rspsize, 0); print $response is responsebr\n; exit; } } else { print NO databr\n; exit; } $err++; } }
SocketConnect
This replace my earlier WebSiteQuestion post, in which maybe the question was too broad. Would there be any issues if I had a perl module called that creates a global socket handle, and then use that handle throughout a bunch of different web pages? Or is there any concerns I should be aware of when doing this kind of persistant socket handle? Thanks, Scott Purcell
Cached Code Disappeared?
Hello, Still seeking assistance form anyone who is experienced with sockets and mod-perl /apache on NT. Anyway, as my previous email showed, I built a site which used a global filehandle to a socket. It worked great for about two hours, and then all of a sudden stopped. After rebooting the apache server, all worked well again. I am thinking that the cached code probably went away since no one hit it for a while? Does apache give back cached scripts after a certain time of not being used? And if that is the case, can I tell the server via the config that I want to keep a certain script or perl module alive in cache for a set time? Thanks Scott Purcell
single process
Hello, In the CGi to mod_perl porting coding guidelines, under the headline sometimes it works, Sometimes it doesn't It says to run the server (during testing) in a single process mode (httpd -X) I tried putting httpd 1 into the conf file, and it got mad at me. How does one set the process (spawning of children) to 1 Thanks Scott Purcell
Forking Child 2
Hello, I wrote a little bit ago about trying to not fork my Apache server. I want to run only a single child. Anyway, I got three terrific responses, but have no clue what they mean. I am on Apache NT4.0 and am learning. Anyway, some of the responses I got for setting a single process were: type: /path/to/apache/dir/httpd -X I have been through my install trying to execute a httpd at the command line, but I am making no connection. Could someone please explain a litle more in detail what I should do on a NT system and what the httpd is (exe?); Thanks Scott Purcell
Mod-Perl Installed next Q
Hello, Thank you all and Ron for the link to savage.net to get my Apache/Perl/ModPerl installed. I was successful about 10 minutes ago and my machine looks happy. Well, now that the package is running, how do I use the persistant memory, do the .pl files need to be named something different. Or how does this mechanism work by putting them in the cgi-bin? Do I just call a module in my code? I want to just play with the server but need to use the mod-perl (persistant behavior). I have some clean code that I would like to move into a bin dir and check. What does one have to do to make this occur. Any links, or examples would be helpful. Thanks again, Scott
Help Apache::Registry Setup
Hello I am trying to learn how to configure and set up the Apache::Registry to cache a script And I am in the documentaton but still getting lost. I am here http://perl.apache.org/guide/porting.html#Before_you_start_to_code And looking at the Exposting Apache::Registry Secrets I entered the counter.pl text and I am running it out of my cgi-bin. And it works, but it IS NOT persistant, or cached. I have been going through the guide, but do not see how to make the counter.pl PERSISTANT and to tie the script to the Apache::Registry? Did I miss something here? Thanks Scott
IOSocket Problem
Hello, I could really use some help here. I have had the following outstanding problem for two weeks. I have read the mod_perl coding guidelines and the code below actually comes from page 7 the counter example. Background: My web site requires a login with a name and password, then I create a login string and I have to open up a socket into a application that lives on a Unix box, (so I use IO::Socket). I followed the coding guidelines on page 7, but still have an issue. The first time they log in, the socket is created and all is good. If I login the next time, it is as if the socket is not being recreated, or something funny. It doesn't work after the first time. Now I know some of this is caused by the persistant mod-perl. But I have used all my variables, and I have called the subroutines with a require like the example, but it still doesn't work. I am showing all code below. Could someone PLEASE glance at that and tell me if you see anything silly. I tried this with ActiveStates .plex and it does the same thing. I usually don't try wolf, but I have been hacking on this for two weeks with no success. ### code I call from the browser #! perl -w use CGI; use strict; use vars qw($q); $q = CGI-new; print $q-header; print $q-start_html(); print BEGIN HEREBR; ### THE NAME AND PASSWORD COME FROM A HTML SOURCE IF NOT TESTING FOR AS. my $password = $q-param('password'); my $username = $q-param('username'); print $password is password and $username is usernamebr\n; open(ISCRYPT, D:/Apache/cgi-bin/plex/iscrypt \$password\ |) or die(Problems encrypting pw: $!); my @password = ISCRYPT; close(ISCRYPT); my $epwd = $password[0]; my $msg = USERLOGIN\t$username\t$epwd\n; print $msg is msgbr\n; require D:/Apache/mod_perl/plex/socket.cgi; my ($status, $response) = ask($msg); print qq{$status and $response is status and responsebr}; the code for the require ## my $handle; sub ask { my ($message) = @_; makeSocket; SendMessage($message); my ($status,$response) = GetResponse(); close($handle); return ($status, $response); undef $status; undef $response; } sub makeSocket { use IO::Socket; $counter = 0; $handle = IO::Socket::INET-new(Proto = 'tcp', PeerAddr = '208.238.162.204', PeerPort = '8000', Type = SOCK_STREAM) or die $@; $handle-autoflush(1); $counter++; print $counter is counterbr\n; print qq{preConnected: 208.238.162.204:8000/pre}; return 1; } sub GetResponse { my $count = 0; my $err = 0; my $response; my $cc; my $header; while ($err 50) { if (read($handle, $cc, 1, 0) == 1) { $header .= $cc; if ($header =~ /^\%BEGIN\s+(\d+)\r?\n/) { # we've acquired one line's worth of response my $rspsize = $1; # how much response to read if (read($handle, $response, $rspsize, 0)) { if ($response =~ /RESPONSE\s*OK/) { return (1, $response); } else { return (-1, $response); } } else { return 0; } } elsif ($header =~ /\%CONTINUE\s*\r?\n/ || $header =~ /\%END\s*\r?\n/) { undef $header; } elsif ($header =~ /\n$/) { die(unknown socket mediabank response: $header); return -1; } else { # keep going haven't hit a newline yet } $count++; } else { $err++; } } return 0; } sub SendMessage { my ($message) = @_; unless ($message) { die(No message in \'SendMessage\'); } my $msgid = int(rand(1000)); $message = $msgid . \t . $message; my $msgsize = length($message); print $message and $msgsize is message and msgsizebr\n; print $handle \%BEGIN\t$msgsize\n$message; } 1; Scott Purcell
Questions Simple
Hello, I am on IIS and fighting ActiveStates .plex. It appears so buggy and flaky that I am losing development time. I want to try some code that is flaky on the IIS/perl .plex on the Apache mod-perl. I know I can download the apache web server in binary form and install it pretty quickly. After that what would I have to do to get mod-perl running? Is this a quick thing, or a long deal. Then I just want to take my clean code and see how it works on that platform. Is mod-perl just a perl module that I require in my scripts? Or is there a lot of server configuration? Please be honest and let me know, Scott Purcell
How To Turn On .pl files on Apache?
Hello, Rookie here. Well I installed the Apache Web Server on my local NT box here and it runs. I have gone through the FAQ's but cannot find out how to turn on .pl files that are in the cgi-bin directory much less making other cgi-bin directories. Could some kind sole please assist me with getting this started. PS I run activeState perl and it is on my C drive of the local machine where the Apache server lives. Thanks, Scott Purcell
Single Process Mode IIS
Hello, I joined the modperl line because I am trying to work with persistent web data. My problem is that I am forced into using PerlEx, which is basically activestates mod-perl. If this offends anyone on this list, please let me know. My hands are tired. I am a perl developer needing assistance. Anyway, I am going over the 'mod_perl_guide CGI to mod_perl Porting and Coding Guidelines.' It is very helpful for anyone dealing with these issues. But anyway, I want to run my IIS server on a single process so I can follow the documentation. Does anyone out there know how to do that? Sincerely, Scott Purcell
Questions Concerning Large Web-Site
Hello, I have a large asset-management system that is web-based. In the past I have always used cgi and perl. I need to rewrite it so that it works with mod-perl or PerlEx Anyway, I used to tie my site together with a main, and a ton of requires (which required pages of subroutines). I would use a hidden variable to do the navigation. So each time the user hit something, I directed them back to the main and used a hidden variable to go spawn a different subroutine. So it was basically a nested application. The site got large (a lot of perl code, over 20,000 lines), and it got slow because each user ended up recompiling the code for each submit. Lately as I am thinking about rebuilding the site, but not using a nested config, but just offering each page to be its own perl file. So when the user submits for a search, I just point them at the search.pl file. Sounds simple enough, but I work alone, and do not know how the world builds large sites. I was hoping to hear some simple input from people who have architected good, sound sites, and was hoping for some good feedback, or some old sample code that I can study and find out how the other half live. I hope this is not asking too much, Any input would be most helpful. Sincerely Scott Purcell
Check Persistance
Hello, Newbie modperl guy has question about the code he created today. This is the beginning of a web site, and when the user logs in, I want to create a socket that will remain persistent in memory until the WebServer is started again. I do NOT want to keep opening up sockets each time this file is read. I believe I have it, but since this is my first chunk I wrote for persistance, I was hoping someone could give it a look. thanks Scott Purcell use vars qw ($q $handle); use CGI; use strict; use IO::Socket; use VBMain::Config qw(%c); $q = CGI-new; print $q-header(); unless ($handle = makeSocket != 0) { die(Cannot figure it out); } sub makeSocket { $handle = IO::Socket::INET-new(Proto = 'tcp', PeerAddr = $c{host}, PeerPort = $c{port}) or return 0; $handle-autoflush(1); print qq{preConnected: $c{host}:$c{port}/pre}; return $handle }