RE: fork/CGI/Apache problem - solved!

2001-11-02 Thread Marco Kleefman

I solved the problem myself... it was a bufferproblem of STDOUT. When I
tried that, I made modifications to the wrong script, that is why I thought
it did not work out! Stupid me! ;)

Thanx everybody who reacted, sorry to have bothered you!

Regards,

Marco

> -Original Message-
> From: Marco Kleefman [mailto:[EMAIL PROTECTED]]
> Sent: vrijdag 2 november 2001 14:30
> To: [EMAIL PROTECTED]
> Subject: fork/CGI/Apache problem
> I have this script which forks off a process which does 
> something. 
> Somehow all print statements in my script which occur before 
> the fork-part
> of the script are printed twice! I have tried to unbuffer 
> STDOUT, but no
> luck until now...



RE: fork/CGI/Apache problem

2001-11-02 Thread Charles Day

You script only printed once for me.

Here's a shortened version I use:

parent stuff above

defined($pid = fork) or die "cannot fork: $!\n";
exit if $pid;
close (STDOUT);

...child stuff below





-Original Message-
From: Marco Kleefman [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 8:30 AM
To: [EMAIL PROTECTED]
Subject: fork/CGI/Apache problem


Hello everybody,

I am new to the list. I have a question I hope you can help me with. It is
not a modperl question, just a normal perl question related to Apache/CGI.

I have this script which forks off a process which does something. I already
encountered the problem of my browser waiting for the child to be finished.
I solved it by closing STDIN/OUT/ERR. But I still have another problem...
Somehow all print statements in my script which occur before the fork-part
of the script are printed twice! I have tried to unbuffer STDOUT, but no
luck until now...

Here's my script:

#! /usr/bin/perl
print "start: pid=$$\n"; # this line gets printed twice!
print "Content-type: text/html\n\n"; # this line gets printed twice!

if (!defined ($pid = fork))
{
die "Unable to fork: $!\n";
}
elsif (! $pid)
{
warn "child: pid=$$\n";

# this is the branch for the child process
close(STDIN); close(STDOUT); close(STDERR);
sleep(60); # pause for 1 minute
 exit; # terminate the child process
}
else
{   # this is the branch for the parent
warn "parent: pid=$$ (child=$pid)\n";
...print some HTML code
exit; # terminate the parent process
}

Best regards,

Marco
The Netherlands

PS I have searched 30 pages of old messages related to forking, but no luck
there! Still I have the feeling that my problem is something trivial... :(




Reading compile settings from within httpd.conf

2001-11-02 Thread matt

Hello list,

Just a quick question:

Is there any way to read apache's compile time settings (like when you
do httpd -V) from within  sections?

Thanks,

Matt

-- 
#!/usr/bin/perl
$A='A';while(print+($A.=(grep{($A=~/(...).{78}$/)[0]eq$_}"  A A A  "
=~m{(...)}g)?"A":" ")=~/([ A])$/){if(!(++$l%80)){print"\n";sleep 1}}




Re: fork/CGI/Apache problem

2001-11-02 Thread Robert Landrum

At 2:30 PM +0100 11/2/01, Marco Kleefman wrote:
>Hello everybody,
>
>I am new to the list. I have a question I hope you can help me with. It is
>not a modperl question, just a normal perl question related to Apache/CGI.
>
>I have this script which forks off a process which does something. I already
>encountered the problem of my browser waiting for the child to be finished.
>I solved it by closing STDIN/OUT/ERR. But I still have another problem...
>Somehow all print statements in my script which occur before the fork-part
>of the script are printed twice! I have tried to unbuffer STDOUT, but no
>luck until now...
>
>Here's my script:
>
>#! /usr/bin/perl
>print "start: pid=$$\n"; # this line gets printed twice!
>print "Content-type: text/html\n\n"; # this line gets printed twice!
>
>if (!defined ($pid = fork))
>{
>die "Unable to fork: $!\n";
>}
>elsif (! $pid)
>{
>warn "child: pid=$$\n";
>
># this is the branch for the child process
>close(STDIN); close(STDOUT); close(STDERR);


You need to close these before you fork.  Right now, you're printing 
your headers out to the buffer.  When you call close, it 
automatically flushes the buffer, and since there are now two buffers 
(you've forked at this point) it prints twice.

Rob

--
"Only two things are infinite: The universe, and human stupidity. And I'm not
sure about the former." --Albert Einstein



fork/CGI/Apache problem

2001-11-02 Thread Marco Kleefman

Hello everybody,

I am new to the list. I have a question I hope you can help me with. It is
not a modperl question, just a normal perl question related to Apache/CGI.

I have this script which forks off a process which does something. I already
encountered the problem of my browser waiting for the child to be finished.
I solved it by closing STDIN/OUT/ERR. But I still have another problem...
Somehow all print statements in my script which occur before the fork-part
of the script are printed twice! I have tried to unbuffer STDOUT, but no
luck until now...

Here's my script:

#! /usr/bin/perl
print "start: pid=$$\n"; # this line gets printed twice!
print "Content-type: text/html\n\n"; # this line gets printed twice!

if (!defined ($pid = fork))
{
die "Unable to fork: $!\n";
}
elsif (! $pid)
{
warn "child: pid=$$\n";

# this is the branch for the child process
close(STDIN); close(STDOUT); close(STDERR);
sleep(60); # pause for 1 minute
 exit; # terminate the child process
}
else
{   # this is the branch for the parent
warn "parent: pid=$$ (child=$pid)\n";
...print some HTML code
exit; # terminate the parent process
}

Best regards,

Marco
The Netherlands

PS I have searched 30 pages of old messages related to forking, but no luck
there! Still I have the feeling that my problem is something trivial... :(





sections

2001-11-02 Thread matt

Hello list,

I am running some mod_perl/apache sites. So far we have 2 disparate
servers, (both running identical software) hosting about 10 sites
each.

I have managed to create a universal httpd.conf using 
sections, a universal config file and a host dependant config file.

In doing so I've come up across some things I've not been able to do
using  sections:

1/- Having to use more than 1 perl section in the config.

This is annoying because I initialize a load of stuff and then its all
lost when the section ends. I have to end the section, because I set
the module path like this:

@PerlSetEnv = 
(
[ 'someflag', $somevar ],
[ 'modulepath', $someothervar ],
);

I can't then 'use' a module in the module path until that section has
been eval'ed - which means I have to end the section. I know I could
do it with a plain apache directive, but then my httpd.conf is not
truly universal.

2/- mod_rewrite

After using mod_rewrite on the default server, I then had to turn it
off everywhere else I had a virtual host or location. The mod_rewrite
docs say:

"This means that you need to have a RewriteEngine on
directive for each virtual host in which you wish to use it."

But it just stays stuck on unless you explicitly turn it off.

3/- ErrorDocument directives don't seem to work

I eventually gave up on getting these to work in perl sections. Now I
do them before the start of the first . Anyone else have better
luck?

4/- Tie::IxHash

Apparently if you have this installed before you configure/install
mod_perl, it will automatically use it to preserve order in hashes. It
doesn't work in my case, and I have to explicitly tie the hashes where
this is important to get things working properly. 

Thanks for any light shed on the above,

Matt

-- 
#!/usr/bin/perl
$A='A';while(print+($A.=(grep{($A=~/(...).{78}$/)[0]eq$_}"  A A A  "
=~m{(...)}g)?"A":" ")=~/([ A])$/){if(!(++$l%80)){print"\n";sleep 1}}





Re: apache::request and other newbie questions

2001-11-02 Thread Nouguier Olivier



John Michael wrote:

I have a modperl script that uses.
cgi.pm and actually I have been importing my on cgi params from get and
post but do use cgi.pm for cookies.  I have read in some other emails
and now in the guide that it is faster to use Apache::Request so I want
to change my script over to this method since it will eventually come under
a heavy load. I added this to my perl.conf filePerlModule Apache::Request
and apache says that it can not find the module in
@INC (@INC contains: /etc/httpd/lib/perl /usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl . /etc/httpd/)
sure enough, I looked in there and it isn't.
I went to the module list and the list claims that apache::request is
included with the standard dist of mod perl.
I'm running Apache 1.3.9 and mod_perl/1.24_01
What should I do? Also, I have a script that is running under apache::registry.I
run the script by using a mod-actions handler that I have in my httpd.conf
file like so.The script runs from a blank index.htm page and creates the
dynamic output depending on the referring url and query-string
 
Apache::Request is not shipped with mod_perl ...
Take a look at CPAN ...
Or http://httpd.apache.org/apreq/
 
AddHandler RTS-protected-htm htm
Action RTS-protected-htm /perl/content_manager/handler.pl

I imagine this is not very efficient?
I guess I will eventually have to set it up as a hander?
What is your opinion?
 
Personnaly, I prefer a very simple handler, using ( owned ) libs, 
than a "script.pl", that much easy to maintains
 
I'm new to packages and modules and have basically little experience
with OOP.  The script works fine with no errors, but I expect a heavy
load in the future. I eventually want to have the correct solution but
I'm trying to beat the learning curve before the traffic gets there.
Can I set up the script now as a handler
or does it have to be written in OO format?
I do understand that a few things have
to be changed, like I have to use apache::constants to finalize the handler
phase.
Reading several books and understanding
more and more everyday.
Any suggestions would be greatly appreciated.
Thanks
John Michael

-- 
My mother always used to tell me, "The early bird gets the worm."
The message seemed pretty clear to me: If you sleep late, you're
a lot less likely to be killed by a bird.
    -- Elliott Downing
 





apache::request and other newbie questions

2001-11-02 Thread John Michael



I have a modperl script that uses. cgi.pm and actually I have been 
importing my on cgi params from get and post but do use cgi.pm for 
cookies.  I have read in some other emails and now in the guide that it is 
faster to use Apache::Request so I want to change my script over to this method 
since it will eventually come under a heavy load.
 
I added this to my perl.conf file

PerlModule Apache::Request
and apache says that it can not find the module in 
@INC (@INC contains: /etc/httpd/lib/perl /usr/lib/perl5/5.6.0/i386-linux 
/usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux 
/usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl . /etc/httpd/) 
sure enough, I looked in there and it isn't.
I went to the module list and the list claims that apache::request is 
included with the standard dist of mod perl.
I'm running Apache 1.3.9 and mod_perl/1.24_01
What should I do?
 
Also, I have a script that is running under apache::registry.
I run the script by using a mod-actions handler that I have in my 
httpd.conf file like so.
The script runs from a blank index.htm page and creates the dynamic output 
depending on the referring url and query-string 


AddHandler RTS-protected-htm htm
Action RTS-protected-htm /perl/content_manager/handler.pl

I imagine this is not very efficient?
I guess I will eventually have to set it up as a hander?
What is your opinion?
I'm new to packages and modules and have basically little experience with 
OOP.  The script works fine with no errors, but I expect a heavy load in 
the future. I eventually want to have the correct solution but I'm trying 
to beat the learning curve before the traffic gets there.
Can I set up the script now as a handler or does it 
have to be written in OO format?
I do understand that a few things have to be changed, 
like I have to use apache::constants to finalize the handler phase.
Reading several books and understanding more and more 
everyday.
Any suggestions would be greatly 
appreciated.
Thanks
John Michael


Perl Script unable to stat

2001-11-02 Thread Mathangi K

Hi
I am using Apache 1.3.20. with perl module 1.25.

In the httpd.conf I have included this line
ScriptAliasMatch ^/cgi-bin/cwb-ipm/(.*)  "D:\IPM1\Server\cgi-bin/$1"

In the cgi-bin I have .exe as well as .pl files.The call to .exe works
fine whereas call to .pl files gives an "page not found error page".

But if I make change in the conf file as
ScriptAlias /cgi-bin "D:\IPM1\Server\cgi-bin"
I am able to access both .exe as well .pl

I need to set an  alias for /cgi-bin/cwb-ipm.How do I do that?
Please clarify me about this.

Thanx
Mathangi









RE: Shutdown

2001-11-02 Thread Matt Sergeant

> -Original Message-
> From: ed phillips [mailto:[EMAIL PROTECTED]]
> 
> "Khachaturov, Vassilii" wrote:
> > 
> > Hi Matt, do you have any news on planned re-appearance of
> > current axkit docs and mailing list archives online? The net people
> > memory is short, if you don't come back noone will know 
> what AxKit is :-(
> > Or did you abandon it in favor of smth better?
> > 
> 
> Just to add to this. I've, several times, recommended Axkit to people,
> only to have them not be able reach axkit.org or axkit.com 
> and have them
> no longer entertain the possibility of working with it

This is sad indeed. Once everything is up and running again I'll write a
complete document of the nightmares that getting it back up again has been
and post it to the mod_perl and axkit lists.

Meanwhile you can get there at http://217.158.50.178/ - the mailing list
links are back to axkit.org, so you need to edit the links with the IP
address again.

Sorry for the downtime, it's *really* not my fault. Blame NetSol, and Demon,
and BT, and ClaraNet (get the idea yet?).

Matt.

_
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.