Apache::Session::Postgres error

2001-01-16 Thread Todd Finney

I'm using Apache::Session::Postgres to track sessions via 
cookies.  When I access a page, the cookie is correctly 
sent by the server, and accepted by the client.  However, 
on the second request, I'm getting a 'Object does not exist 
in data store' error.

It looks like the session is not being stored in the 
database, although I can't figure out why.  When running 
postmaster -d 2, I get the following output:

started: host=localhost user=postgres database=sessions
InitPostgres
StartTransactionCommand
query: begin
ProcessUtility: begin
CommitTransactionCommand
StartTransactionCommand
query:
 INSERT INTO sessions (id, a_session) 
VALUES 
('8efc89ae6006cfdfa24d12eba4019526','AwMBCiA4ZWZjODlhZTYwMD
ZjZmRmYTI0ZDEyZWJhNDAxOTUyNlgLX3Nlc3Npb25faWRY
')
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
query: rollback
ProcessUtility: rollback
CommitTransactionCommand
StartTransactionCommand
query: begin
ProcessUtility: begin
CommitTransactionCommand
StartTransactionCommand
query:
 UPDATE sessions SET a_session = 
'AwMAWA==
' WHERE id = NULL
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
query: commit
ProcessUtility: commit
CommitTransactionCommand
StartTransactionCommand
query: begin
ProcessUtility: begin
CommitTransactionCommand

It appears to be rolling back the insert transaction, but I 
don't know why.  The session does not appear in the 
database, and all subsequent requests fail.   I've tried 
undef'ing, untie'ing, and make_modified (and various 
combinations) on the hash, to no avail.

The whole handler is below, in case you're interested.

thanks,
Todd


package LocalSites::Session;

use strict;
use Apache::Constants qw( DECLINED);
use Apache::Log;
use Apache::Session::Postgres;

sub handler {
 my $r = shift;
 my $log = $r-server-log();
 my $session;
 my $use_cookies = $r-dir_config-{'UseCookies'} || 0;

 if ($use_cookies) {
 $log-error("Session: Begin Transaction Using 
Cookies");
 $session = $r-header_in('Cookie');
 $session =~ s/SESSION_ID=(\w*)/$1/;
 $log-error("Session: ID is $session");
 } else {
 $log-error("Session: Begin Transaction Using Path 
Info");
 # Placeholder for code to extract SESSION_ID from 
the path
 }
 undef $session if ! $session;

 my %session = ();
 tie %session, 'Apache::Session::Postgres', $session, {
 DataSource='dbi:Pg:dbname=sessions',
 UserName='postgres',
 Password='password',
 Commit=1
 };
 my $cookie = "SESSION_ID=".%session-{_session_id}."; 
domain=.dom.com; path=/;";
 $r-header_out("Set-Cookie"=$cookie ) if ! $session;
 $r-pnotes('SESSION_ID', %session-{_session_id});
 $r-pnotes('AUTH_LEVEL', %session-{auth_level} || 0 
);
 $log-error("Session: ".%session-{_session_id});
 untie(%session);
 undef %session;
 $log-error("Session: End Transaction");
 return DECLINED;
}




Following fresh compile from new src...

2001-01-16 Thread andrewl

Hello mod_perl gurus,

I have the following:
RHL 7.0 (linux 2.2.16)
Apache 1.3.14
mod_perl.1.24_01
Perl 5.6.0
and an upgraded glibc to version 2.96-69

I followed the "installation in 10 Lines" instructions, with one
amendment:
% cd /usr/src
 % lwp-download
http://www.apache.org/dist/apache_x.x.x.tar.gz
 % lwp-download
http://perl.apache.org/dist/mod_perl-x.xx.tar.gz
 % tar xzvf apache_x.x.x.tar.gz
 % tar xzvf mod_perl-x.xx.tar.gz
 % cd mod_perl-x.xx
 % perl Makefile.PL   (RIGHT HERE I ADDED A "CONFIGURED FOR
MY SITE" SET OF ARGUMENTS
SUPPLIED BY MY COMRADE 73, Ged)
If you should need that argument list, I can supply it.
 % make
 % make test
 % make install
 % cd ../apache_x.x.x
 % make install

and drum roll please the make test and make install worked!!!
IT WORKED!!!  I did NOT receive an error 29 on line 27 in modules/src.t
.  The last thing I did that seems to have cured the error was to apply
the gcc-2.96-69.src.rpm .   (A thank you to kind souls that helped me
come this far!)

However, I now have a new error when I run ../bin/apachectl configtest
from the /usr/local/apache/conf directory.  (Is it possible that because
of the supplied arguments in the perl Makefile.pl that I now have to run
this from a new directory?  I have some new
directories--httpd_perl/conf, httpd_perl/logs, ... proxy, and  run
but I don't believe I HAVE to start apache from these directories).

Invalid command 'Order' on line 333 in httpd.conf.

The first instance of 'Order' is in this segment of code, generated by
the install routine (i.e. the default) and the error is occurring with
this instance.
--
Directory "/usr/local/apache/htdocs"
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Indexes FollowSymLinks MultiViews
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options",
"FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
/Directory
--
This is in the default file and I have not dinked with this section of
the httpd.conf file.  Shouldn't this work?  What am I doing wrong .
now?   Some fly in the ointment unbenounced to me?

TIA
Andrew Lietzow
(Now almost losing site of the original objective)







Re: Following fresh compile from new src...

2001-01-16 Thread darren chamberlain

andrewl ([EMAIL PROTECTED]) said something to this effect on 01/16/2001:
 Invalid command 'Order' on line 333 in httpd.conf.

This will appear if you disabled mod_access via something like
'--disable-module=access' in your APACI_ARGS Apache configure commands.

(darren)

-- 
In the fight between you and the world, back the world.



Upgrading mod_perl on production machine (again)

2001-01-16 Thread Bill Moseley

This is a revisit of a question last September where I asked about
upgrading mod_perl and Perl on a busy machine.

IIRC, Greg, Stas, and Perrin offered suggestions such as installing from
RPMs or tarballs, and using symlinks.  The RPM/tarball option worries me a
bit, since if I do forget a file, then I'll be down for a while, plus I
don't have another machine of the same type where I can create the tarball.
 Sym-linking works great for moving my test application into live action,
but it seems trickier to do this with the entire Perl tree.

Here's the problem: this client only has this one machine, yet I need to
setup a test copy of the application on the same machine running on a
different port for the client and myself to test.  And I'd like to know
that when the test code gets moved live, that all the exact same code is
running (modules and all).

What to do in this situation?

a) not worry about it, and just make install mod_perl and restart the server
and hope all goes well?

b) cp -rp /usr/local/lib/perl5 and use symlinks to move between the two?
When ready to move, kill httpd, change the perl symlinks for the binary,
perl lib, and httpd, and restart?

c) setup a new set of perl, httpd, and my application and when ready to go
live just change the port number? 

Or simply put - how would you do this:

With one machine I want to upgrade perl to 5.6.0, upgrade your application
code, new version of mod_perl, and allow for testing of the new setup for a
few weeks, yet only require a few seconds of downtime to switch live (and
back again if needed)?

Then I wonder which CPAN module I'll forget to install...



Bill Moseley
mailto:[EMAIL PROTECTED]



Help! --- mod_perl + DBI:mysql:connect - Error.

2001-01-16 Thread yen-ying . chen-dreger

Hi,

from a mod_perl module using DBI and Apache::Registry as PerlModule i can
not connect to a mysql database. 

The Browser gets an error message that the document hat no data while in the
logfile of apache stands "child pid 31955 exit signal Segmentation fault
(11)". I am sure that the connection fails. (This script works no problem if
the connection to database is not needed.)

Strange is that there is no problem from a normal perl-cgi-script to connect
to this mysql-database. With eval-block i can not get any error message and
have no chance at all to handle the error.

I use the following versions :

Mysql : 3.22.32
Apache : 1.3.12 (Unix)
mod_perl : 1.24
DBI : 1.13
DBD::mysql 2.0414

Can someone help me? I am much appreciated for any suggestion.

My code looks like the followings:

use strict ;
use DBI ;

sub handler
{
# some codes
my $dbh;
eval{ $dbh=DBI-connect("DBI:mysql:my_database", "my_name", "my_passwd") or
die "Can't connect $DBI::errstr" ;} ;
if ($@)
{   # do something
return OK ; 
}
else
{   # do something; 
}

# still codes
}

1;
---

Regards,
Yen-Ying




Re: Upgrading mod_perl on production machine (again)

2001-01-16 Thread Greg Cope

Bill Moseley wrote:
 
 This is a revisit of a question last September where I asked about
 upgrading mod_perl and Perl on a busy machine.
 
 IIRC, Greg, Stas, and Perrin offered suggestions such as installing from
 RPMs or tarballs, and using symlinks.  The RPM/tarball option worries me a
 bit, since if I do forget a file, then I'll be down for a while, plus I
 don't have another machine of the same type where I can create the tarball.
  Sym-linking works great for moving my test application into live action,
 but it seems trickier to do this with the entire Perl tree.
 
 Here's the problem: this client only has this one machine, yet I need to
 setup a test copy of the application on the same machine running on a
 different port for the client and myself to test.  And I'd like to know
 that when the test code gets moved live, that all the exact same code is
 running (modules and all).
 
 What to do in this situation?
 
 a) not worry about it, and just make install mod_perl and restart the server
 and hope all goes well?

Hum  ignoring problem means that will bite you ! 

 
 b) cp -rp /usr/local/lib/perl5 and use symlinks to move between the two?
 When ready to move, kill httpd, change the perl symlinks for the binary,
 perl lib, and httpd, and restart?

This is what I would do.

depending on present set up I would install all the above in a "new"
location - and then symlink to it.  Yup this does mean a few more disk
stat's, but means I can roll back most installs very quickly if
required.

Having said that I have not done it too often on an alien box.  Also is
the present perl easily simlinkable (i.e the binary and the lib tree).

I just play with the --prefix and usually do --prefix=package_version
(eg apache_perl_1.3.14 would be a mod_perl apache version 1.3.14).

Also you could script the change over if required to be xtra quick 
(although this is getting silly)

I've used this without any issues on Linux boxes for 18 months, but I am
very conservative about my perl (i.e I'm still on 5.005_03 and waiting
for 5.6.1 ;-)

 
 c) setup a new set of perl, httpd, and my application and when ready to go
 live just change the port number?
 
 Or simply put - how would you do this:
 
 With one machine I want to upgrade perl to 5.6.0, upgrade your application
 code, new version of mod_perl, and allow for testing of the new setup for a
 few weeks, yet only require a few seconds of downtime to switch live (and
 back again if needed)?
 
 Then I wonder which CPAN module I'll forget to install...

do a CPAN snapshot bundle of a known good install, and install that -
easy no ?

Just my 2 euro worth.

Greg

 
 Bill Moseley
 mailto:[EMAIL PROTECTED]



Re: Upgrading mod_perl on production machine (again)

2001-01-16 Thread Steve Reppucci


Not that I have an answer to this complete problem, but I have had similar
situation, so I'll also be interested in the solutions you uncover.

I've always handled the support of multiple perl versions by installing
new versions of perl using a prefix like /usr/local/perl/5.6.0, etc.,
(I also place CPAN's build directory under that tree.)

This makes it easy to install and test new versions of perl without
affecting running applications that have been built against a previous
perl version, as well as making it possible to test with specific versions
just by referencing the appropriate version in the script's shebang line
(or by setting my PATH appropriately when building mod_perl.)

Using this method, I symlink the "current default" version of perl and its
tools in the standard public directory (/usr/bin or /usr/local/bin).

Upgrading mod_perl versions has been a headache though, as I'm similarly
hesitant to simply 'make install' new mod_perl releases without being able
to test that all of my running applications work correctly.  I suppose
your idea of archiving the lib tree (/usr/local/perl/5.6.0/lib in my
setup) before running the 'make install' so that it's easy to roll back
should something fail is prudent.  But it still doesn't solve the problem
of being able to fully install (in its real final location, not in a
private directory...) new versions of mod_perl without affecting stuff
that's already running.  (Maybe I'm just tilting at windmills in worrying
about testing modperl from a private directory install...) 

So how *do* others handle this upgrade situation?

Steve

On Tue, 16 Jan 2001, Bill Moseley wrote:

 This is a revisit of a question last September where I asked about
 upgrading mod_perl and Perl on a busy machine.
 
 IIRC, Greg, Stas, and Perrin offered suggestions such as installing from
 RPMs or tarballs, and using symlinks.  The RPM/tarball option worries me a
 bit, since if I do forget a file, then I'll be down for a while, plus I
 don't have another machine of the same type where I can create the tarball.
  Sym-linking works great for moving my test application into live action,
 but it seems trickier to do this with the entire Perl tree.
 
 Here's the problem: this client only has this one machine, yet I need to
 setup a test copy of the application on the same machine running on a
 different port for the client and myself to test.  And I'd like to know
 that when the test code gets moved live, that all the exact same code is
 running (modules and all).
 
 What to do in this situation?
 
 a) not worry about it, and just make install mod_perl and restart the server
 and hope all goes well?
 
 b) cp -rp /usr/local/lib/perl5 and use symlinks to move between the two?
 When ready to move, kill httpd, change the perl symlinks for the binary,
 perl lib, and httpd, and restart?
 
 c) setup a new set of perl, httpd, and my application and when ready to go
 live just change the port number? 
 
 Or simply put - how would you do this:
 
 With one machine I want to upgrade perl to 5.6.0, upgrade your application
 code, new version of mod_perl, and allow for testing of the new setup for a
 few weeks, yet only require a few seconds of downtime to switch live (and
 back again if needed)?
 
 Then I wonder which CPAN module I'll forget to install...
 
 
 
 Bill Moseley
 mailto:[EMAIL PROTECTED]
 

=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=
Steve Reppucci   [EMAIL PROTECTED] |
Logical Choice Software  http://logsoft.com/ |




Re: Upgrading mod_perl on production machine (again)

2001-01-16 Thread David McCabe

 From: Steve Reppucci [EMAIL PROTECTED]
 Date: Tue, 16 Jan 2001 11:02:44 -0500 (EST)
 Subject: Re: Upgrading mod_perl on production machine (again)
 
 I've always handled the support of multiple perl versions by installing
 new versions of perl using a prefix like /usr/local/perl/5.6.0, etc.,
 (I also place CPAN's build directory under that tree.)
 
 This makes it easy to install and test new versions of perl without
 affecting running applications that have been built against a previous
 perl version, as well as making it possible to test with specific versions
 just by referencing the appropriate version in the script's shebang line
 (or by setting my PATH appropriately when building mod_perl.)

That is what I do as well. Plus, I use the prefix arg to build Apache as well, so a
new mod_perl/Apache gets installed in a different dir than the current one when I run
make install. I then copy over my config files to the new dir, and set up the new
Apache to listen on a different port, then test it. Once tested, I point the
sym-links for both Apache and perl to the new locations.

This is whole process is scripted for me, for both Solaris and AIX, and works great
on both. (There are differences in the scripts, though, because of differences in the
OS)

BTW, for making sure you get all the modules your old perl had, look at the CPAN
module, which has a "autobundle" command to create a Bundle file from your old perl
installation, that you can then use with your new perl, by doing a "install
Bundle::BundleName".



David McCabe  Unix System Administrator
Le Groupe Videotron [EMAIL PROTECTED]   (514) 380 4433

How can we (men) possibly use sex to get what we want??
Sex _is_ what we want!!!
  Dr Frasier Crane




With high request rate, server stops responding with load zero

2001-01-16 Thread Honza Pazdziora


Hello,

I've looked through the docs and archives but either I cannot come
with proper search keywords, or ... please redirect me if this was
discussed recently.

We have four Linux PCs with Apache 1.3.12, mod_perl 1.24 with 5.05_03
behind LVS, they run scripts under PerlRun with PerlRunOnce set (it's
not an option to change this at the moment unfortunatelly), the
scripts connect_on_init to Oracle on Solaris box.

The configuration of the Apaches is

MinSpareServers 10
MaxSpareServers 20
StartServers 10
MaxClients 30
MaxRequestsPerChild 20  # but with PerlRunOnce this is in fact 1

The Oracle server is doing just fine, the boxes never swap, they run
at a load on 0.20 normally.

From time to time, there is massively increased request rate. At that
moment, the load on the Apache boxes goes up to 1.5 or 2, there are
those 30 httpd's visible on top listing, after that, messages

[Tue Jan 16 16:56:42 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 8 children, there are 1 idle, and
 26 total children
[Tue Jan 16 16:56:43 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 16 children, there are 1 idle, an
d 29 total children
[Tue Jan 16 16:56:44 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 32 children, there are 0 idle, an
d 26 total children
[Tue Jan 16 16:56:45 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 32 children, there are 2 idle, an
d 28 total children
[Tue Jan 16 16:56:46 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 32 children, there are 1 idle, an
d 26 total children
[Tue Jan 16 16:56:47 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 32 children, there are 2 idle, an
d 29 total children
[Tue Jan 16 16:56:48 2001] [info] server seems busy, (you may need to increase S
tartServers, or Min/MaxSpareServers), spawning 32 children, there are 0 idle, an
d 28 total children

appear in the error log. After that the load on the box goes down to
zero, the box disappears from the LVS tables and doesnt't accept any
connections (not even those that go directly on that machine).

What bothers me about the "server seems busy messages" is that each
second it tries to start 32 children even if MaxClients is 30 and it
has 28 children total running, and that it repeats this (to me)
nonsense three to five times.

We found out by stracing the hanging httpd's that it's waiting on
descriptor 5 and a Un*x guy here says from some indications (you
cannot say much about hanging processes) that it's the socket to the
browser.

To me it looks like the boxes would be able to handle the load (slowly
but gradually) but they deadlock somehow, with no I/O or CPU
activity.

My questions would be: did anybody saw this behaviour? Are the busy
messages normal (especially the 32 vs. 30 vs. 28 numbers)? Do the
Max/Min configuration values seem insane to you? I've also compiled
1.3.14 to check whether it would help -- it's the same story.

Directions to docs/archives and opinions would be highly appreciated,

-- 

 Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, auth. WWW servers, XML/XSL, ...
Petition for a Software Patent Free Europe http://petition.eurolinux.org




Re: Help! --- mod_perl + DBI:mysql:connect - Error.

2001-01-16 Thread G.W. Haywood

Hi there,

On Tue, 16 Jan 2001 [EMAIL PROTECTED] wrote:

 from a mod_perl module using DBI and Apache::Registry as PerlModule i can
 not connect to a mysql database. 

Have you looked at the mod_perl Guide?

http://perl.apache.org/guide

 The Browser gets an error message that the document hat no data
 while in the logfile of apache stands "child pid 31955 exit signal
 Segmentation fault (11)". I am sure that the connection fails.

You Apache child is crashing.  You may need to debug that.
See the debugging section of the Guide too.  Did you compile
everything from source?
 
73,
Ged.





Re: With high request rate, server stops responding with load zero

2001-01-16 Thread G.W. Haywood

Hi there,

On Tue, 16 Jan 2001, Honza Pazdziora wrote:

 I've looked through the docs and archives but either I cannot come
 with proper search keywords, or ... please redirect me if this was
 discussed recently.

Maybe there might be something relevant in the recent thread about
nasty robots?  Dunno what it was called.
 
 MaxClients 30

What happens of you increase this 40?  You don't make it clear whether
you're using a light front end, how much the machine can take etc.

 What bothers me about the "server seems busy messages" is that each
 second it tries to start 32 children even if MaxClients is 30 and it
 has 28 children total running, and that it repeats this (to me)
 nonsense three to five times.

I wouldn't worry about that - it's probably nonsense.  Worry about the
load spikes and why your server can't handle them.

 My questions would be: did anybody saw this behaviour? Are the busy
 messages normal (especially the 32 vs. 30 vs. 28 numbers)? Do the
 Max/Min configuration values seem insane to you?

No, dunno, no in that order.

73,
Ged.




Re: Following fresh compile from new src...

2001-01-16 Thread G.W. Haywood

Hi again Andrew,

On Tue, 16 Jan 2001, andrewl wrote:

 Invalid command 'Order' on line 333 in httpd.conf.

What have you done to your httpd.conf?  The order directive should be
OK for even a plain Apache!  Is the opening Directory ... tag missing?

Wanna send me the file? (Privately)

73,
Ged.




Re: Following fresh compile from new src...

2001-01-16 Thread G.W. Haywood

Hi again,

On Tue, 16 Jan 2001, I wrote:

Is the opening Directory tag missing?

Well, no, it had just scrolled off the screen.

Oops.

73,
Ged.




Re: HTTP_REFERRER and Mod_perl

2001-01-16 Thread Keith G. Murphy

"Khachaturov, Vassilii" wrote:
 
 Please keep in mind that what you describe is a behaviour of one particular
 user agent.
 Some UAs just never send referer for anonymity. (Sometimes proxy will do
 that for them). Some do it for links from a web page, but not from a file://
 URL. Some don't care for the URI scheme, and you get referer's from one's
 bookmarks on the disk.
 
Another example:

Just noticed the other day that NS6 won't send a referer if the user
does "open in a new window" when right-clicking a link to a script. 
Gack.  Though I would consider that a bug.



Re: Upgrading mod_perl on production machine (again)

2001-01-16 Thread Perrin Harkins

 The RPM/tarball option worries me a
 bit, since if I do forget a file, then I'll be down for a while, plus I
 don't have another machine of the same type where I can create the
tarball.

There's no substitute for testing.  If it's really important to have a very
short down time, you need a similar machine where you can test a new
package.  Short of that, the symlink suggestions people have made are
probably the best you can do.

- Perrin




Re: With high request rate, server stops responding with load zero

2001-01-16 Thread Honza Pazdziora

On Tue, Jan 16, 2001 at 05:04:42PM +, G.W. Haywood wrote:
 
 Maybe there might be something relevant in the recent thread about
 nasty robots?  Dunno what it was called.

Read it all, but I'm affraid it doesn't apply to my situation. All the
requests that we get bombed with are legitimate (intranet, auth,
etc.). So I'd really like to serve them as well as I can.

  MaxClients 30
 
 What happens of you increase this 40?  You don't make it clear whether

I'll play with the configuration tomorrow when the load comes again.

 you're using a light front end, how much the machine can take etc.

No light front end, but most of the clients are on 10 Mb (behind
a couple of routers but still on a decent network). The machines
are alright memorywise, they seem to be a bit slow on CPU, however
what bothers me is the deadlock situation to which they get. No more
slow crunching, they just stop accepting connections.

 I wouldn't worry about that - it's probably nonsense.  Worry about the
 load spikes and why your server can't handle them.

OK, thanks.

Is there a way to allow a lot of children to be spawned but limit
the number of children that serve requests? With the PerlRunOnce
situation in which I am stuck, I know that I will need to start the
children, but as soon as they get started, a request is thrown on
them. I'd like them to start and wait and be ready, but only accept
request when other request has just finished. Something like

MaxClients 15   # processing requests
MaxChildren 30  # have a reserve of 15 to use when previous
# request finishes (and the previous child dies)

? I could hack the Apache source to do that, but does it sound like it
would help to decrease the load?

-- 

 Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, auth. WWW servers, XML/XSL, ...
Petition for a Software Patent Free Europe http://petition.eurolinux.org




Finding out what has been enabled on a mod perl server

2001-01-16 Thread Kevin Beckford

Hello all,
I need to find out what has been enabled on my production server. I want to 
use 
method handlers, but I am unsure if that has been compiled in. How would I do 
this? I don't have the access to install mod-status - so the easy way is not for 
me...




Re: Apache::Session::Postgres error

2001-01-16 Thread Edmund Mergl

Todd Finney wrote:
 
 I'm using Apache::Session::Postgres to track sessions via
 cookies.  When I access a page, the cookie is correctly
 sent by the server, and accepted by the client.  However,
 on the second request, I'm getting a 'Object does not exist
 in data store' error.
 
 It looks like the session is not being stored in the
 database, although I can't figure out why.  When running
 postmaster -d 2, I get the following output:
 


This problem has been reported several times.
find below the explanation of Francis J. Lacoste
from Sun, 17 Oct 1999.

Edmund



This is because the DBIStore insert the encoded session data as
binary data. PostgreSQL doesn't like that. You have to modify
Apache::Session::DBIStore (or better implement a PGStore) 
to uuencode the session data. You can use for that MIME::Base64
or better yet

pack( "u*" ) and unpack ( "u*" ).

I have a Apache::Session::DBIUUStore that does just that
and that I use for similar reason. I also added a last_update
field to the table which tracks the last update to the session
data. Email me if you want it. (Available on perl licensing terms)

Hope this helps.




-- 
http://www.edmund-mergl.de
fon: +49 700 edemergl



mod_perl and dbi:Oracle

2001-01-16 Thread Aleksandr Vladimirskiy

Hi,

I am building a system using apache,mod_perl and oracle. it is in the
very early stages. right now all i have is a module that prints out a
simple text string to the browser. for the next step i am trying to
access an oracle db, but get a message in the error log from the module
that ORACLE_HOME environment variable isn't set. i have tried to set
this variable in the module itself as well as in the apache
configuration file (the Location that governs my program) but without
success.

Can anyone help?

Alex Vladimirskiy



Re: Finding out what has been enabled on a mod perl server

2001-01-16 Thread David McCabe

 From: Kevin Beckford [EMAIL PROTECTED]
 Date: Tue, 16 Jan 2001 13:19:16 -0500
 Subject: Finding out what has been enabled on a mod perl server
 
 Hello all,
   I need to find out what has been enabled on my production server. I want to 
use 
 method handlers, but I am unsure if that has been compiled in. How would I do 
 this? I don't have the access to install mod-status - so the easy way is not for 
 me...

Apachedir/bin/httpd -l



David McCabe  Unix System Administrator
Le Groupe Videotron [EMAIL PROTECTED]   (514) 380 4433

How can we (men) possibly use sex to get what we want??
Sex _is_ what we want!!!
  Dr Frasier Crane




Re: Finding out what has been enabled on a mod perl server

2001-01-16 Thread Kevin Beckford

That will tell me if mod_perl.c is has been installed. I know that. What I want 
to find out is if during the installation, did the installer (Was not me!) set

PerlMethodHandlers on

and other flags of that kind during the install.

How would I do that?

 
 Apachedir/bin/httpd -l
 




Re: Finding out what has been enabled on a mod perl server

2001-01-16 Thread JR Mayberry

Apache::Status will tell you

perldoc Apache::Status


Kevin Beckford wrote:
 
 That will tell me if mod_perl.c is has been installed. I know that. What I want
 to find out is if during the installation, did the installer (Was not me!) set
 
 PerlMethodHandlers on
 
 and other flags of that kind during the install.
 
 How would I do that?
 
 
  Apachedir/bin/httpd -l
 

-- 
__
JR Mayberry e-Vend.net Corporation
Programmer and Systems Administrator(888) 427-8743 x226 tel
[EMAIL PROTECTED]http://www.e-vend.net


The information in this message (including attachments) is confidential.
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited.  If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
***



RE: Finding out what has been enabled on a mod perl server

2001-01-16 Thread Geoffrey Young


 -Original Message-
 From: Kevin Beckford [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 16, 2001 2:01 PM
 To: David McCabe
 Cc: [EMAIL PROTECTED]
 Subject: Re: Finding out what has been enabled on a mod perl server
 
 
 That will tell me if mod_perl.c is has been installed. I know 
 that. What I want 
 to find out is if during the installation, did the installer 
 (Was not me!) set
 
 PerlMethodHandlers on
 
 and other flags of that kind during the install.
 
 How would I do that?

if you are using a recent version of mod_perl (like cvs, not 1.24_01)  you
can 

perldoc Apache::MyConfig

and see how to get to those options without starting your server...

otherwise, you can configure perl status and go to /perl-status?hooks

HTH

--Geoff

 
  
  Apachedir/bin/httpd -l
  
 



Re: Apache::Session::Postgres error

2001-01-16 Thread Todd Finney

At 01:28 PM 1/16/01, Edmund Mergl wrote:
Todd Finney wrote:
  It looks like the session is not being stored in the
  database, although I can't figure out why.  When 
 running
  postmaster -d 2, I get the following output:
 

This problem has been reported several times.
find below the explanation of Francis J. Lacoste
from Sun, 17 Oct 1999.

Yes, I saw that.  Francis was addressing the use of 
Apache::Session::DBI, however.  Since that time, JWB has 
released Apache::Session::Postgres and 
Apache::Session::Store::Postgres, the data store for the 
former.  I (perhaps incorrectly) assumed that he had 
implemented the correct conversion in this module.

Do I still need to do this conversion under the newer 
Apache::Session?

Todd





Re: mod_perl and dbi:Oracle

2001-01-16 Thread Benoit Caron

At 13:32 1/16/2001 -0500, Aleksandr Vladimirskiy wrote:
Hi,

I am building a system using apache,mod_perl and oracle. it is in the
very early stages. right now all i have is a module that prints out a
simple text string to the browser. for the next step i am trying to
access an oracle db, but get a message in the error log from the module
that ORACLE_HOME environment variable isn't set. i have tried to set
this variable in the module itself as well as in the apache
configuration file (the Location that governs my program) but without
success.

Can anyone help?

I'm doing :

$ENV{'ORACLE_HOME'} = '/opt/oracle/product/8.0.5';

in the handler's code and everything is fine...

Hope this help



Benoit Caron
Analyste-Programmeur
Netgraphe - Webfin.com - Le Web Financier
[EMAIL PROTECTED]
- - - - - - - - - - - - - - - - - - - - - - - -
"The number of Unix installations has grown to 10,
  with more expected."
-- The Unix Programmer's Manual, 2nd edition, June '72




[OT] All of Perldocs to HTML files

2001-01-16 Thread Martin Langhoff

Hi,

I know this is is wy OT. Kick me privately, please. I am looking
for a way to dump all of the available perldocs into an organized HTML
structure. Activestate people are doing it in their standard distro --
but I couldn't find how. They even get cross-module links ("See Also")
just fine. 

Is there a know script for that? A canonical way to do it?



Martin



Re: [OT] All of Perldocs to HTML files

2001-01-16 Thread T.J. Mather

have you looked at Pod::Html ?

You can use that together with File::Find to convert a directory of pods.




Re: Apache::Session::Postgres error

2001-01-16 Thread Jeffrey W. Baker

On Tue, 16 Jan 2001, Todd Finney wrote:

 I'm using Apache::Session::Postgres to track sessions via
 cookies.  When I access a page, the cookie is correctly
 sent by the server, and accepted by the client.  However,
 on the second request, I'm getting a 'Object does not exist
 in data store' error.

Looks like it could be a transaction handling problem.  I'll have a look
tonight. -jwb


 It looks like the session is not being stored in the
 database, although I can't figure out why.  When running
 postmaster -d 2, I get the following output:

 started: host=localhost user=postgres database=sessions
 InitPostgres
 StartTransactionCommand
 query: begin
 ProcessUtility: begin
 CommitTransactionCommand
 StartTransactionCommand
 query:
  INSERT INTO sessions (id, a_session)
 VALUES
 ('8efc89ae6006cfdfa24d12eba4019526','AwMBCiA4ZWZjODlhZTYwMD
 ZjZmRmYTI0ZDEyZWJhNDAxOTUyNlgLX3Nlc3Npb25faWRY
 ')
 ProcessQuery
 CommitTransactionCommand
 StartTransactionCommand
 query: rollback
 ProcessUtility: rollback
 CommitTransactionCommand
 StartTransactionCommand
 query: begin
 ProcessUtility: begin
 CommitTransactionCommand
 StartTransactionCommand
 query:
  UPDATE sessions SET a_session =
 'AwMAWA==
 ' WHERE id = NULL
 ProcessQuery
 CommitTransactionCommand
 StartTransactionCommand
 query: commit
 ProcessUtility: commit
 CommitTransactionCommand
 StartTransactionCommand
 query: begin
 ProcessUtility: begin
 CommitTransactionCommand

 It appears to be rolling back the insert transaction, but I
 don't know why.  The session does not appear in the
 database, and all subsequent requests fail.   I've tried
 undef'ing, untie'ing, and make_modified (and various
 combinations) on the hash, to no avail.

 The whole handler is below, in case you're interested.

 thanks,
 Todd


 package LocalSites::Session;

 use strict;
 use Apache::Constants qw( DECLINED);
 use Apache::Log;
 use Apache::Session::Postgres;

 sub handler {
  my $r = shift;
  my $log = $r-server-log();
  my $session;
  my $use_cookies = $r-dir_config-{'UseCookies'} || 0;

  if ($use_cookies) {
  $log-error("Session: Begin Transaction Using
 Cookies");
  $session = $r-header_in('Cookie');
  $session =~ s/SESSION_ID=(\w*)/$1/;
  $log-error("Session: ID is $session");
  } else {
  $log-error("Session: Begin Transaction Using Path
 Info");
  # Placeholder for code to extract SESSION_ID from
 the path
  }
  undef $session if ! $session;

  my %session = ();
  tie %session, 'Apache::Session::Postgres', $session, {
  DataSource='dbi:Pg:dbname=sessions',
  UserName='postgres',
  Password='password',
  Commit=1
  };
  my $cookie = "SESSION_ID=".%session-{_session_id}.";
 domain=.dom.com; path=/;";
  $r-header_out("Set-Cookie"=$cookie ) if ! $session;
  $r-pnotes('SESSION_ID', %session-{_session_id});
  $r-pnotes('AUTH_LEVEL', %session-{auth_level} || 0
 );
  $log-error("Session: ".%session-{_session_id});
  untie(%session);
  undef %session;
  $log-error("Session: End Transaction");
  return DECLINED;
 }






Re: Apache::Session::Postgres error

2001-01-16 Thread Jeffrey W. Baker

On Tue, 16 Jan 2001, Edmund Mergl wrote:

 Todd Finney wrote:
 
  I'm using Apache::Session::Postgres to track sessions via
  cookies.  When I access a page, the cookie is correctly
  sent by the server, and accepted by the client.  However,
  on the second request, I'm getting a 'Object does not exist
  in data store' error.
 
  It looks like the session is not being stored in the
  database, although I can't figure out why.  When running
  postmaster -d 2, I get the following output:
 


 This problem has been reported several times.
 find below the explanation of Francis J. Lacoste
 from Sun, 17 Oct 1999.

 Edmund



 This is because the DBIStore insert the encoded session data as
 binary data. PostgreSQL doesn't like that. You have to modify
 Apache::Session::DBIStore (or better implement a PGStore)
 to uuencode the session data. You can use for that MIME::Base64
 or better yet

 pack( "u*" ) and unpack ( "u*" ).

That's not true anymore.  Apache::Session 1.5+ have UUE and MIME modules
for talking to Pg and other binary-averse backing stores.  UUE is
automatically selected when Pg is in use.

-jwb




using a handler in a module file

2001-01-16 Thread Kevin Beckford

I want to use an apache module in an .htaccess file. What would be the syntax 
with that? I'm assuming that it will be along the lines of


  PerlModule Goofy::Nav
Files  goofy.nav
SetHandler perl-script
PerlHandler Goofy::Nav
/Files

but I can't seem to get that to work. Any ideas?




Re: Apache::Session::Postgres error

2001-01-16 Thread Edmund Mergl

Edmund Mergl wrote:
 
 Todd Finney wrote:
 
  I'm using Apache::Session::Postgres to track sessions via
  cookies.  When I access a page, the cookie is correctly
  sent by the server, and accepted by the client.  However,
  on the second request, I'm getting a 'Object does not exist
  in data store' error.
 
  It looks like the session is not being stored in the
  database, although I can't figure out why.  When running
  postmaster -d 2, I get the following output:
 
 
 This problem has been reported several times.
 find below the explanation of Francis J. Lacoste
 from Sun, 17 Oct 1999.
 
 Edmund
 
 This is because the DBIStore insert the encoded session data as
 binary data. PostgreSQL doesn't like that. You have to modify
 Apache::Session::DBIStore (or better implement a PGStore)
 to uuencode the session data. You can use for that MIME::Base64
 or better yet
 
 pack( "u*" ) and unpack ( "u*" ).
 
 I have a Apache::Session::DBIUUStore that does just that
 and that I use for similar reason. I also added a last_update
 field to the table which tracks the last update to the session
 data. Email me if you want it. (Available on perl licensing terms)
 
 Hope this helps.
 



sorry, I forgot the email address: 
 
"Francis J. Lacoste" [EMAIL PROTECTED]


Edmund


-- 
http://www.edmund-mergl.de
fon: +49 700 edemergl



Re: Upgrading mod_perl on production machine (again)

2001-01-16 Thread brian moseley

On Tue, 16 Jan 2001, David McCabe wrote:

  From: Steve Reppucci [EMAIL PROTECTED]
  
  I've always handled the support of multiple perl versions by installing
  new versions of perl using a prefix like /usr/local/perl/5.6.0, etc.,
  (I also place CPAN's build directory under that tree.)
 
 That is what I do as well. Plus, I use the prefix arg to
 build Apache as well, so a new mod_perl/Apache gets
 installed in a different dir than the current one when I
 run make install. I then copy over my config files to
 the new dir, and set up the new Apache to listen on a
 different port, then test it. Once tested, I point the
 sym-links for both Apache and perl to the new locations.

we go one step further and install perl and other libraries
with each version of our application, into say
/usr/local/webmail/5.0.0.1 or whatever. that way everything
the application depends on is in the version-specific
directory.

we drive our entire build and install process with make; the
whole process is something like this (abbreviated):

  cvs co Makefile.webmail
  make -f Makefile.webmail checkout build install rpm

checkout pulls all the library and application sources from
cvs and scps pre-compiled distributions from a package
machine. build compiles everything. install puts it into
/usr/local/webmail/version. rpm packages up the
installation directory. then to deploy in production, we rpm
-i on each machine, and a post-install script flips the
symlink to point at the new version. rollback is trivial.




[OT] ROFLMAO Web Site

2001-01-16 Thread Jimi Thompson

For everyone who's every been presented with one of those stupid "motivational"
posters, mugs, etc. when you would have rather been given what they spent for
the piece of crap..

http://www.despair.com/






Apache::ASP

2001-01-16 Thread Francis Mendoza

Hello Help,

I was wondering if you can help me answer my problem.
I'm using Linux 2.2.14, Apache-1.3.11 and mod_perl-1.21

I wan't to install ASP for my APACHE-1.3.11.  i already installed the
mod_perl-1.21.

I downloaded the apache-asp-2.07.tar.gz
when I used the $perl Makefile.PL it said that i need more module.
So I used $perl -MCPAN -e shell

I used CPAN to install the Bundle::Apache::ASP
right after I used CPAN it told me all this:
MLDBM is up to date
DATA::Dumper is up to date
MD5 is up to date
CGI is up to date
HTML::Clean is up to date
Net::SMTP is up to date
HTTP::Date is up to date
Devel::Symdump is up to date
Apache::DBI is up to date
Compress::Zlib is up to date
Tie::Cache is up to date
Time:HiRes is up to date
Apache::ASP is up to date

Does this mean that I have Apache::ASP installed in my Linux already?

If I do have Apache::ASP already installed in my Linux.. What is my next
step?  What Do i need to add in the Apache httpd.conf?


Thank you for time and answer my questions,


Francis M.


__
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup



Re: Apache::ASP

2001-01-16 Thread G.W. Haywood

Hi there,

On Tue, 16 Jan 2001, Francis Mendoza wrote:

 Does this mean that I have Apache::ASP installed in my Linux already?

Looks that way.

 If I do have Apache::ASP already installed in my Linux.. What is my
 next step?

You need to do some reading.  The documentation is in there with
Apache::ASP.  Try 'perldoc Apache::ASP'.  If that doesn't work, find
the directory with ASP.pm in it.  Go there and try 'perldoc ./ASP.pm'.

73,
Ged.




Re: Redirecting a multipart/form-data POST request

2001-01-16 Thread Darren Stuart Embry

On 2001-01-15, Ask Bjoern Hansen [EMAIL PROTECTED] wrote:

  When I do neither, i.e., leave the POST request as is and use
  the standard redirect mechanism, the browser hangs and the
  server actually does not send the redirect until I hit the Stop
  button (I'm using ngrep to determine this).  This also happens
  if I use the $r-print($header) method and still return
  REDIRECT.

 Try adding 
 
 $r-method('GET');
 $r-headers_in-unset('Content-length');
 
 to your code before doing the return REDIRECT.

Ask Bjoern, I privately replied to you on this as well.

I should have been more clear and said I was doing exactly this,
as per [1], when I mentioned I was converting POST requests to
GET requests.

This is so that I could get redirects to work in response to a
urlencoded POST request using the standard redirection technique
of setting the Location header and mime type and returning
REDIRECT instead of manually constructing and $r-print()ing a
header.

In any case, [1] does me no good with multipart/form-data which
is what I was asking about in the first place.

Darren

[1] http://perl.apache.org/guide/snippets.html#Convert_a_POST_Request_into_a_GE

-- 
Darren Stuart Embry.  A whole roasted almond in every piece!
http://www.webonastick.com/
``To undo most things in Excel, click the undo button.''
  -- Actual ToolTip from Microsoft Office 97



Re: FileMan - Not enough arguments for mkdir

2001-01-16 Thread George Sanderson

At 03:12 PM 1/16/2001 +0200, you wrote:

Some linuxes required to have correct permission set in mkdir (it
fails on mkdir $dir; needs to be mkdir $dir,0775;), so make test
fails... (FileMan.pm line 771 and several times below..)

I fixed all the mkdirs with "mkdir $dir,0755".  I think 0755 is all that is
required.  Let me know if this doesn't fix your problem.

Thank you for your input.





Re: With high request rate, server stops responding with load zero

2001-01-16 Thread Perrin Harkins

On Tue, 16 Jan 2001, Honza Pazdziora wrote:
 The machines are alright memorywise, they seem to be a bit slow on
 CPU, however what bothers me is the deadlock situation to which they
 get. No more slow crunching, they just stop accepting connections.

I've only seen that happen when something was hanging them up, like
running out of memory or waiting for a database resource.  Are you using
NFS by any chance?

 Is there a way to allow a lot of children to be spawned but limit
 the number of children that serve requests?

I don't think you want that.  If the server is busy, Apache will spawn
more as soon as it can.  Of course PerlRunOnce is a huge
liability.  Getting rid of that would surely help a lot.

- Perrin




Re: mod_perl and dbi:Oracle

2001-01-16 Thread Tom Mornini

On Tue, 16 Jan 2001, Benoit Caron wrote:

 I am building a system using apache,mod_perl and oracle. it is in the
 very early stages. right now all i have is a module that prints out a
 simple text string to the browser. for the next step i am trying to
 access an oracle db, but get a message in the error log from the module
 that ORACLE_HOME environment variable isn't set. i have tried to set
 this variable in the module itself as well as in the apache
 configuration file (the Location that governs my program) but without
 success.

I do it in the startup.pl file, and all is fine for all scripts
thereafter.

-- 
-- Tom Mornini
-- InfoMania Printing and Prepress




Re: Redirecting a multipart/form-data POST request

2001-01-16 Thread Gerd Kortemeyer

 I am writing a program that needs to process form data, (here's
   the kicker) which is sometimes multipart/form-data, then
   redirect a user to a GET request (which doesn't need to process
   the form data).  I would like to use the standard mechanism for
   issuing a redirect, for other reasons:

   $r-header_out('Location' = $url);
   return REDIRECT;


Not sure what the problem is, but I frequently use REDIRECTs and receive both
"normal" and "multipart" posts.

Please find the code section below that I use to get the POSTed data. After
that, in order to REDIRECT, I use

  $r-content_type('text/html');
   $r-header_out(Location =
'http://'.$ENV{'HTTP_HOST'}.$disurl);
   return REDIRECT;

Hope this helps.

Enjoy,

- Gerd.

 Getting all kind of posted stuff:

my $buffer;

$r-read($buffer,$r-header_in('Content-length'));

unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si)
{
my @pairs=split(//,$buffer);
my $pair;
foreach $pair (@pairs) {
   my ($name,$value) = split(/=/,$pair);
   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
   $name  =~ tr/+/ /;
   $name  =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
   $ENV{"form.$name"}=$value;
}
} else {
my $contentsep=$1;
my @lines = split (/\n/,$buffer);
my $name='';
my $value='';
my $fname='';
my $fmime='';
my $i;
for ($i=0;$i=$#lines;$i++) {
if ($lines[$i]=~/^$contentsep/) {
if ($name) {
chomp($value);
if ($fname) {
$ENV{"form.$name.filename"}=$fname;
$ENV{"form.$name.mimetype"}=$fmime;
} else {
$value=~s/\s+$//s;
}
$ENV{"form.$name"}=$value;
}
if ($i$#lines) {
$i++;
$lines[$i]=~

/Content\-Disposition\:\s*form\-data\;\s*name\=\"([^\"]+)\"/i;
$name=$1;
$value='';
if ($lines[$i]=~/filename\=\"([^\"]+)\"/i) {
   $fname=$1;
   if
($lines[$i+1]=~/Content\-Type\:\s*([\w\-\/]+)/i) {

  $fmime=$1;
  $i++;
   } else {
  $fmime='';
   }
} else {
$fname='';
$fmime='';
}
$i++;
}
} else {
$value.=$lines[$i]."\n";
}
}
}
$r-method_number(M_GET);
$r-method('GET');
$r-headers_in-unset('Content-length');






begin:vcard 
n:Kortemeyer;Gerd
tel;fax:(517) 432-2175
tel;work:(517) 432-5468
x-mozilla-html:FALSE
url:http://www.lite.msu.edu/kortemeyer/
org:LITE Lab;DSME MSU
version:2.1
email;internet:[EMAIL PROTECTED]
title:Instructional Technology Specialist
adr;quoted-printable:;;123 North Kedzie Labs=0D=0AMichigan State University;East Lansing;MI;48824;USA
fn:Gerd Kortemeyer
end:vcard