Re: Missing html code using dynagzip

2003-06-03 Thread Scott Alexander
On Mon, 2 Jun 2003, Slava Bizyayev wrote:

 I guess, your problem is out of Apache::Dynagzip. Please, try to follow:

 1. Make sure your script is producing correct response under
 Apache::Registry.

Yes it does


 2. Make sure your script does not have any internal conditional branches on
 whether it runs under Apache::Registry, or under Apache::RegistryFilter -
 Apache::Dynagzip.


No it doesn't

 3. Do your transition from Apache::Registry configuration to
 Apache::RegistryFilter - Apache::Dynagzip configuration by simple
 replacement of the line:

 PerlHandler Apache::Registry

 with the following two lines:

 PerlHandler Apache::RegistryFilter Apache::Dynagzip
 PerlSetVar Filter On


Okay now it works! So problem was in my httpd.conf file.

Now I only have

Directory /usr/local/systems/work/

   # AUTH
AuthType Apache::Authenticate
AuthName protected
PerlAccessHandler Apache::OpenAccess
PerlAuthenHandler Apache::Authenticate-authenticate
require valid-user

   Files *.html
PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
   /Files

## DYNA
Files *.pl
 PerlSendHeader On
 SetHandler perl-script
 PerlHandler Apache::RegistryFilter Apache::Dynagzip
 PerlSetVar Filter On
 Options +ExecCGI
#PerlSetVar LightCompression On

# Below not needed ??
#PerlSetVar UseCGIHeadersFromScript Off
#PerlSendHeader Off
#PerlSetupEnv On

/Files
/Directory



 You may optionally add light compression finally if you want. You are not
 supposed to change any other settings.


But if I turn on PerlSetVar LightCompression On the problem comes back.
I had tested having this line commented out but it made no difference.

Anyway good that it is working.

Thanks.

Regards
Scott

 4. Let us know details of what you finally have.

 Thanks,
 Slava


 - Original Message -
 From: Scott Alexander [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 02, 2003 5:26 AM
 Subject: Missing html code using dynagzip


  Hi,
 
  When using
 
  Files *.pl
  SetHandler perl-script
  PerlHandler Apache::RegistryFilter Apache::Dynagzip
  PerlSetVar Filter On
 
  PerlSetVar LightCompression On
  Options +ExecCGI
 
  PerlSetVar UseCGIHeadersFromScript Off
  PerlSendHeader Off
  PerlSetupEnv On
  /Files
 
  this setup with NN 6+ the code ends with
 
  /html/html (yes twice) and in IE 6.0 it has just /html  (missing the
  last '' With NN 4.8 it is the same as IE 6.0.
 
  Does anyone know why this happens?
 
  I've tried putting all my output into one print statement. Makes no
  difference.
 
  Scott
 
 
 
 
 
 




Missing html code using dynagzip

2003-06-02 Thread Scott Alexander
Hi,

When using

Files *.pl
SetHandler perl-script
PerlHandler Apache::RegistryFilter Apache::Dynagzip
PerlSetVar Filter On

PerlSetVar LightCompression On
Options +ExecCGI

PerlSetVar UseCGIHeadersFromScript Off
PerlSendHeader Off
PerlSetupEnv On
/Files

this setup with NN 6+ the code ends with

/html/html (yes twice) and in IE 6.0 it has just /html  (missing the
last '' With NN 4.8 it is the same as IE 6.0.

Does anyone know why this happens?

I've tried putting all my output into one print statement. Makes no
difference.

Scott







Re: gzipchain

2003-05-28 Thread Scott Alexander
On Wed, 28 May 2003, Slava Bizyayev wrote:

Yes it does work with my current configuration. Note I had Files *.pl
inside of Directory /usr/local/systems/work/

Having different directories (one for compression, one not) is
messy in my case.

What about the idea of a fixup handler? In scripts that the user selects
to output in csv or rtf I could use
$r-dir-config-set(Script_Compression = 'Off') ; then my fixup handler
look for that value and turn off compression. But how do I actually turn
off compression?

The scripts that always output rtf I will rename to a new extension, but
the scripts users can select the output then I must use a fixup
handler.

Also why does my own Content-type: text/html turn up in output? I guess
dynagzip is setting it's own content-type header.


Scott

 Hi Scott,

 In my understanding your script responds correctly from the configuration

 Directory /usr/local/systems/work/

PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
 # AUTH
 AuthType Apache::Authenticate
 AuthName protected
 PerlAccessHandler Apache::OpenAccess
 PerlAuthenHandler Apache::Authenticate-authenticate
 require valid-user

 /Directory

 Please, let me know if I'm wrong.

 Assuming it does, you would probably better try the following replacement:

 Directory /usr/local/systems/work/

PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::RegistryFilter Apache::Dynagzip
PerlSetVar Filter On
PerlSetVar LightCompression On
Options +ExecCGI
 # AUTH
 AuthType Apache::Authenticate
 AuthName protected
 PerlAccessHandler Apache::OpenAccess
 PerlAuthenHandler Apache::Authenticate-authenticate
 require valid-user

 /Directory

 It should compress all output from this directory.

 When you need to distinguish compression between different types of output,
 it's the most simple solution to run each type of outgoing content from the
 own directory. You might have one compressed directory and one plain then.
 Otherwise you need to write your own fixup handler to turn compression off
 dynamically.

 Please let me know if it works for you.

 Thanks,
 Slava

 - Original Message -
 From: Scott Alexander [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 11:04 PM
 Subject: Re: gzipchain


  On Mon, 26 May 2003, Perrin Harkins wrote:
 
   Scott Alexander wrote:
Yes if I join all my output using
   
$print = $print . html source
   
and then one print at the end
   
AND change my script name from script.pl to script.html it works.
   
The script I experimented on went from 15000 bytes down to 2900 bytes!
   
Do I have to change all my scripts from pl to html ?
And why must I have everything in one print statement for it to work?
  
   I'm not sure why those changes helped, but you should know that
   Apache::GzipChain is not in wide use anymore.  Most people use either
   Apache::Compress or Apache::Dynagzip.  You can read more about them
 here:
  
 http://perl.apache.org/docs/tutorials/client/compression/compression.html
  
   - Perrin
 
  Okay thanks now I'm using Dynagzip. The results are quite impressive.
 
  Some of my scripts output rtf or csv. The user can select the output
  format (html/csv) so depending on their selection I need to have
  compression turned off. Some scripts only output rtf. All my scripts have
  the extension 'pl'.
 
  I have tried $r-dir_config-set(Filter = 'Off') ; if user script outputs
  rtf.
 
  Is there some way I can turn off compression for certain scripts. I could
  rename the extension for scripts that I don't want compression, but in the
  case where the user can select the output then those scripts won't benefit
  from compression. It would be easier to turn it off dynamically than to
  rename my scripts, links, form action='' etc etc.
 
  Also why does IE 6 display different html code compared to Netscape?
 
  Netscape displays it correctly, but IE only displays '/body/html' at
  the end. It's always missing the last ''
 
  My httpd.conf is
 
  Directory /usr/local/systems/work/
 
 PerlSendHeader On
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options +ExecCGI
 
  ## DYNAGZIP
  Files *.pl
  SetHandler perl-script
  PerlHandler Apache::RegistryFilter Apache::Dynagzip
  PerlSetVar Filter On
  PerlSetVar UseCGIHeadersFromScript Off
  PerlSendHeader Off
  PerlSetupEnv On
  PerlSetVar LightCompression On
  /Files
 
 
  # AUTH
  AuthType Apache::Authenticate
  AuthName protected
  PerlAccessHandler Apache::OpenAccess
  PerlAuthenHandler Apache::Authenticate-authenticate
  require valid-user
 
  /Directory
 
 
  Scott
 
 




Re: gzipchain

2003-05-27 Thread Scott Alexander
On Mon, 26 May 2003, Perrin Harkins wrote:

 Scott Alexander wrote:
  Yes if I join all my output using
 
  $print = $print . html source
 
  and then one print at the end
 
  AND change my script name from script.pl to script.html it works.
 
  The script I experimented on went from 15000 bytes down to 2900 bytes!
 
  Do I have to change all my scripts from pl to html ?
  And why must I have everything in one print statement for it to work?

 I'm not sure why those changes helped, but you should know that
 Apache::GzipChain is not in wide use anymore.  Most people use either
 Apache::Compress or Apache::Dynagzip.  You can read more about them here:
 http://perl.apache.org/docs/tutorials/client/compression/compression.html

 - Perrin

Okay thanks now I'm using Dynagzip. The results are quite impressive.

Some of my scripts output rtf or csv. The user can select the output
format (html/csv) so depending on their selection I need to have
compression turned off. Some scripts only output rtf. All my scripts have
the extension 'pl'.

I have tried $r-dir_config-set(Filter = 'Off') ; if user script outputs
rtf.

Is there some way I can turn off compression for certain scripts. I could
rename the extension for scripts that I don't want compression, but in the
case where the user can select the output then those scripts won't benefit
from compression. It would be easier to turn it off dynamically than to
rename my scripts, links, form action='' etc etc.

Also why does IE 6 display different html code compared to Netscape?

Netscape displays it correctly, but IE only displays '/body/html' at
the end. It's always missing the last ''

My httpd.conf is

Directory /usr/local/systems/work/

   PerlSendHeader On
   SetHandler perl-script
   PerlHandler Apache::Registry
   Options +ExecCGI

## DYNAGZIP
Files *.pl
SetHandler perl-script
PerlHandler Apache::RegistryFilter Apache::Dynagzip
PerlSetVar Filter On
PerlSetVar UseCGIHeadersFromScript Off
PerlSendHeader Off
PerlSetupEnv On
PerlSetVar LightCompression On
/Files


# AUTH
AuthType Apache::Authenticate
AuthName protected
PerlAccessHandler Apache::OpenAccess
PerlAuthenHandler Apache::Authenticate-authenticate
require valid-user

/Directory


Scott



$r-headers_in-get('Referer') doesn't work with IE

2003-03-04 Thread Scott Alexander
Hi,

I using recipe 10.4 from the mod_perl cookbook.

in

sub logout ($$) {

  # I'm setting the logout address to be the login page again. My login page
  # is made up of /bin/$environment_name/
  # With Netscape it works fine ..

  my ($self, $r) = @_;
  my $uri = $r-headers_in-get('Referer') ;
  my @split = split /\//, $uri ;
  my $db = $split[4] ;

  $self-SUPER::logout($r);

  my $logout_address = /bin/ . $db . / ;
  $r-headers_out-set(Location = $logout_address);


  return REDIRECT;

}

Checking the log file for netscape everything is as expected.

User can login, work, logout - back to login page ready for next user.

But with IE 6.0 the $r-uri and $r-headers_in-get('Referer') is
different than for NN. It is the next page being called in this case just
/logout so I no longer know what was my db value.

Any ideas how to solve this?

Scott







Override Authentication for one sub directory

2003-03-02 Thread Scott Alexander
Hi,

I'm using Apache-AuthCookie-3.04 for authentication
I have a protected directory with 10 sub directories, one directory needs
to be open to any user.

I could write 10 Directory /usr/local/systems/work/directory_1 or use a
PERL section in the conf file to create the 10 directory directives.

Can I override the settings for one directory somehow? So any user with no
login or password will get in. Actually I don't even want the login prompt
to appear.

In my httpd.conf file I have

Directory /usr/local/systems/work/
PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI

AuthType Apache::Authenticate
AuthName protected
PerlAuthenHandler Apache::Authenticate-authenticate
require valid-user

/Directory


Directory /usr/local/systems/work/open/
# in this directory I need to allow any user
/Directory

Thanks

Scott



Apache::TicketAccess

2003-02-20 Thread Scott Alexander
Hi,

I'm trying to use the example from the Eagle book on page 309 - 314 using
the TicketAccess, TicketMaster, TicketTool handlers.

In TicketMaster in sub go_to_uri it sets the a cookie with the $ticket.

I can print $ticket to error log to see what it contains. But for some
reason the cookie never gets set.

Netscape's cookie manager doesn't show any new cookie from my site.


Here is a copy from my httpd.cong file for the two servers.

david1 is a mod_proxy for the mod_perl server (david)

On david1 I have
ProxyPass /login.pl http://david:8080/login.pl
ProxyPassReverse /login.pl http://david:8080/


On david the mod_perl server in the httpd.conf file I have


Location /login.pl
SetHandler  perl-script
PerlHandler Apache::TicketMaster
PerlSetVar  TicketDomain   david1
PerlSetVar  TicketSecret   /key.txt
PerlSetVar  TicketDatabase mysql:admin
PerlSetVar  TicketTableperson:user:passwd
PerlSetVar  TicketExpires  100
/Location



Directory /usr/local/systems/work/
PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI

# OLD
#AuthName Oppilaitosjärjestelmä
#AuthType Basic
#PerlAuthenHandler Apache::AuthAny
#require valid-user
#Limit GET POST PUT DELETE
#require valid-user
#/Limit

# NEW
PerlAccessHandler Apache::TicketAccess
PerlSetVar TicketDomain david1
PerlSetVar TicketSecret   /key.txt
PerlSetVar  TicketDatabase mysql:admin
PerlSetVar  TicketTableperson:user:passwd
PerlSetVar  TicketExpires  100
ErrorDocument 403 /login.pl

ErrorDocument 401 /bin/admin/error/401.html
#ErrorDocument 403 /bin/admin/error/403.html
ErrorDocument 404 /bin/admin/error/404.html
ErrorDocument 500 /bin/admin/error/500.html
/Directory

Any help is appreciated

Scott




Re: Apache::TicketAccess

2003-02-20 Thread Scott Alexander
On Thu, 20 Feb 2003, Scott Alexander wrote:

If I set my browser to david:8080/login.pl then everything works okay,
Cookie gets set, and my session is current until I logout.

So the setup is something to do with mod_proxy on the proxy server.

Is it the cookie doesn't get sent back thru the reverse proxy?

I use cookies in some other areas of the application and they are working
fine since moving over to a reverse_proxy server, mod_perl server setup.

Regards

Scott


 Hi,

 I'm trying to use the example from the Eagle book on page 309 - 314 using
 the TicketAccess, TicketMaster, TicketTool handlers.

 In TicketMaster in sub go_to_uri it sets the a cookie with the $ticket.

 I can print $ticket to error log to see what it contains. But for some
 reason the cookie never gets set.

 Netscape's cookie manager doesn't show any new cookie from my site.


 Here is a copy from my httpd.cong file for the two servers.

 david1 is a mod_proxy for the mod_perl server (david)

 On david1 I have
 ProxyPass /login.pl http://david:8080/login.pl
 ProxyPassReverse /login.pl http://david:8080/


 On david the mod_perl server in the httpd.conf file I have
 

 Location /login.pl
 SetHandler  perl-script
 PerlHandler Apache::TicketMaster
 PerlSetVar  TicketDomain   david1
 PerlSetVar  TicketSecret   /key.txt
 PerlSetVar  TicketDatabase mysql:admin
 PerlSetVar  TicketTableperson:user:passwd
 PerlSetVar  TicketExpires  100
 /Location



 Directory /usr/local/systems/work/
 PerlSendHeader On
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options +ExecCGI

 # OLD
 #AuthName Oppilaitosjärjestelmä
 #AuthType Basic
 #PerlAuthenHandler Apache::AuthAny
 #require valid-user
 #Limit GET POST PUT DELETE
 #require valid-user
 #/Limit

 # NEW
 PerlAccessHandler Apache::TicketAccess
 PerlSetVar TicketDomain david1
 PerlSetVar TicketSecret   /key.txt
 PerlSetVar  TicketDatabase mysql:admin
 PerlSetVar  TicketTableperson:user:passwd
 PerlSetVar  TicketExpires  100
 ErrorDocument 403 /login.pl

 ErrorDocument 401 /bin/admin/error/401.html
 #ErrorDocument 403 /bin/admin/error/403.html
 ErrorDocument 404 /bin/admin/error/404.html
 ErrorDocument 500 /bin/admin/error/500.html
 /Directory

 Any help is appreciated

 Scott





Re: [OT] mod_proxy, mod_perl, php

2002-12-19 Thread Scott Alexander
On Wed, 18 Dec 2002, Perrin Harkins wrote:

 Scott Alexander wrote:
  At the moment I have a front_end server with no php support.
 
  Backend is mod_perl. I'm planning to extend our document management
  system to serve www pages.
 
  The html documents are on the mod_perl machine. What happens if users add
  php code to their html documents?

 Nothing, unless you add PHP support to that machine and make sure
 mod_perl is not serving those documents.  You can't have them both
 handle the same documents.


No mod_perl doesn't serve the documents. I'm just using a PerlTranshandler
to change the uri.

  If I add php support on the front_end will it work normally?

 No, not if the front-end is proxying.  It has to be actually serving
 those documents locally in order to run them through PHP.

 - Perrin


So if I add php support to the mod_perl server. How much extra
load/memory usage strain  will it add to the mod_perl server.

The setup is front_end 2*550 PIII scsi drives 2 GB

mod_perl server 2*1200  scsi 36 GB 2GB

database server  2*1200  scsi 36 GB 2GB

About 3 - 5 scripts per day  plus 5000 rewrites using the
PerlTranshandler for the web pages.

Database machine is handling abou 2 million queries per day.

If I add a www -management system to our existing intranet application I
want that all the www pages are in the www -management system not php
pages on the front_end (have to add php support of course) and html pages
on the mod_perl server.

Or would it be better to have a nfs on the front_end accessible from the
mod_perl server. So users can update the documents using the intranet
application. Then www requests are handled only by the front end with now
added php support.


Best Regards

Scott




[OT] mod_proxy, mod_perl, php

2002-12-18 Thread Scott Alexander
At the moment I have a front_end server with no php support.

Backend is mod_perl. I'm planning to extend our document management
system to serve www pages.

The html documents are on the mod_perl machine. What happens if users add
php code to their html documents?

If I add php support on the front_end will it work normally?

Regards and thanks in advance for any help. And sorry if this is way off
topic. I don't know what mailing list to ask this on. I'm doing distance
work and living 150 km above the Arctic Circle 

Scott




reverse_proxy ?

2002-10-30 Thread Scott Alexander
Hi,

In a test environment I have a apache front_end server and a
apache mod_perl server both are on two physical different machines, plus
another machine for the database.

Our production server is one machine running only one instance of
apache/mod_perl and another machine for the database.

Users can upload documents, set rights as to who can download/update the
documents. The documents are kept in a directory outside of the document
root. I use Transhandler to rewrite the uri to the correct file location.
A http_referer also has to be present for the user to get the file.


I want to put all the documents on the front_end which is not running
mod_perl (here is a copy from the installation ./configure
--prefix=/usr/local/apache --enable-module=ssl --enable-module=rewrite
--enable-module=proxy --disable-module=cgi)

Then as far as I can see the documents would have to be under documentroot
which means anyone can have access to them just by guessing the url.

Any ideas how I can have the documents on the front_end and still maintain
some level of security.

/Scott




Reverse Proxy Setup

2002-09-26 Thread Scott Alexander

Hi,

I have two experimental servers frontend and mod_perl.

mod_perl is apache with mod_perl
frontend is apache lightweight

My config only passes *.pl thru to mod_perl

When a user uploads a file they use a mod_perl script on mod_perl and the
file is saved on mod_perl.

But I want the file to be on frontend as it makes sense for when they
download the file ... they only need a lightweight apache server to do
that.

So far I can think of doing

1. Putting a cgi script on frontend to handle file uploads and save the
file on frontend.

2. Use network file share between mod_perl and frontend.

Any other ideas?

Scott







Re: modperl questions

2001-12-18 Thread Scott Alexander

On Tue, 18 Dec 2001, Alastair Stuart wrote:

 question one

 There is a need to add new client profiles to the centralised
 database, which create new application filesystems, new database
 structures and CGI trees.  Thus a new profile can be created
 and activated with the push of a few buttons, but, as it stands,
 the cgi structure looks like this

 https://www.foo.co.za/cgi-bin/client1/index.pl
 https://www.foo.co.za/cgi-bin/client2/index.pl

 it would be better if it was

 https://www.foo.co.za/client1
 https://www.foo.co.za/client2

 just using normal aliasing,

 but now the problem,


 -- how to add new aliases to httpd.conf or ./conf/clients.pl
 without having to restart apache ??

I've used

RewriteEngine on
RewriteRule ^/bin/([^/]+)/(.*) /usr/local/systems/work/$2


and then

sub db {
# get the $db from the url
my @split_line = split /\//, $ENV{REQUEST_URI} ;
my $db = $split_line[2] ;
return $db ;
}

and the $db I use to get a db handle

That's how I do it but my application leans towards cgi than mod_perl.

I have 4 different types of systems using the same codebase. Alltogether
13 systems. Works well.

regards

Scott


  - i have found no linear solution, but there may be a
 craftier solution, even if some reworking needs to be done


 second question:

 Now that we have multiple application and databse instances
 running concurrently, how do we ensure that filehandle and
 Apache::DBI symbols are reliably encapsulated in their
 own namespsaces, all running off the same codebase ?



 I just feel i need a bit of affirmation that this is 100% before
 i start this arduous journey

 Thanks




 Alastair Stuart
 Systems Developer
 Quirk R  D
 3rd Floor Armoury Building
 Buchanan Square
 160 Sir Lowry Road
 Cape Town
 7925

  eml: [EMAIL PROTECTED]
 land: +27 21 462 7353
  fax: +27 21 462 7354

 http://www.quirk.co.za






Re: [OT] Re: DB_File needs compatible versions

2001-10-03 Thread Scott Alexander

On Wed, 3 Oct 2001 [EMAIL PROTECTED] wrote:


 1) I changed the symlink of db.h under /usr/include (btw, I'm using redhat 7.1)
 and point it to db2/db.h
 i.e.   lrwxrwxrwx1 root root8 Jul 12 11:05 db.h - db2/db.h

 2) untar the source of db_file.pm and modify the config.in file
   a - change the value of INCLUDE to /usr/include
   b - change the value of LIB to /usr/lib
   c - change the value of DBNAME to -db2

 3) save and compile, install the source.

Just in case someone else has the same problem ...

I did all the above but not

'2 c - change the value of DBNAME to -db2'

And in /usr/lib/ I created a sym link libdb.a pointing to libdb2.a (the
version I wanted to use and then it worked.


thanks everyone for your help

now back to modperling after a hard disk broke.

Scott




undef an array

2001-06-01 Thread Scott Alexander

Hi,

in my code I have

my @upper_id ;

during the code I pass the array by reference to a sub routine

and push values onto it.

push @{$upper_id}, $row[0] ;

Some of my code I have arrays of strings or ints.

I might add 100 or more items to each array. The strings could be
50 characters long.

What happens to the array at the end?

Should I have a

undef @upper_id ;
 at the end ?

If I don't have this does it mean the array just stays in memory until
the child is stopped?

A the moment the max child life is set at 300.

Any help or pointers would be greatly appreciated.

regards

Scott




Environment variables in startup.pl

2001-04-27 Thread Scott Alexander

Should this work in a startup.pl file

my $hostname = $ENV{HOSTNAME} ;

from the prompt I can write echo $HOSTNAME and get the correct 
hostname of the server. 

But from within startup.pl I don't get it.

Scott



Difference between NN and IE

2001-02-16 Thread Scott Alexander

Hi,

Why is it Netscape displays the pop up authenticate window when the user enters 
the wrong password. But Internet Explorer displays my 401.html page if I return 
an AUTH_REQUIRED; from my AuthAny.pm handler?

If I click on the pop up window cancel in Netscape then it will display the 
401.html page. 

With Explorer the user actually has to close all Explorer Windows and start it 
again to get another attempt at logging in.

regards

and thanks in advance

Scott




Setting remote_user and passwd

2001-02-16 Thread Scott Alexander

Hi,

Is it possible to set 

$r-connection-user and

the $sent_pw values.

(my($res, $sent_pw) = $r-get_basic_auth_pw ;)

My problem is if a user logins with xxx password yyy I want to 
change their login to  password abcd.

It works now but the user is confronted with the pop window asking 
them to login again but can I get pass this stage?

Would using cookies by pass this problem?

regards

Scott
_
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Re: Too many connections with DBI

2001-01-12 Thread Scott Alexander

On 11 Jan 2001, at 8:28, Scott Alexander wrote:

My original message was below.

I always understood each Apache child runs for a set number of 
times then stops. But I checked my httpd.conf file and the 
MaxRequestsPerChild is set to 0

Why would it ever ask for a new connect? Or is there something 
else causing the child to stop running?

Scott

 Hi,
 
 Why do I see this in the log 
 
 13402 Apache::DBI need ping: yes
 13402 Apache::DBI new connect to 
 'my_dbmy_usermy_passwdAutoCommit=1PrintError=1'
 
 when I have in the startup.pl file
 
 Apache::DBI-connect_on_init
  ("DBI:mysql:my_db", "my_user","my_passwd",
   {
PrintError = 1, # warn() on errors
RaiseError = 0, # don't die on error
AutoCommit = 1, # commit executes immediately
   }
  );
 
 Is it because the child has reached it's maximum life ?


_____
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Too many connections with DBI

2001-01-10 Thread Scott Alexander

HI,

I'm using a AuthAny handler to authenticate for every script. Today 
for the first time the production server was put thru it's paces. I had 
about 80 users at the same time. Checking the apache error log 
there were a lot of 

DBI-connect failed: Too many connections at 
/systems/humakpro/lib/library.pm line 213

I have 10 different databases. Would I solve this problem if I started 
using persistent connections? I've installed ApacheDBI on a test 
server but I can't produce the same load or can I ?

I'm also using a Apache::AuthAny.pm to authenticate for each script.

Those 80 users used today about 14000 scripts in 5 hours but each 
script has many queries sent to the database. The database handle 
is opened at the beginning and closed at the end of each script.
The handle is passed to a function in library.pm and from there it is 
closed. Is this wrong to do? Like wise the handle is opened from 
within a function. 

i.e. I have 

sub footer {
   # display a standard footer etc etc
if ($_[0] != 1  $_[0] ne ""){
$_[0]-disconnect ;
   }
}
  

It really peaked at 14:38:41 and then in the error_log

Ouch!  malloc failed in malloc_block()
DBI-connect failed: Too many connections at 
/systems/humakpro/lib/library.pm line 213
[Wed Jan 10 14:38:41 2001] [error] Can't call method "prepare" 
without a package or object reference at /syst$

Ouch!  malloc failed in malloc_block()
Ouch!  malloc failed in malloc_block()
Ouch!  malloc failed in malloc_block()
Ouch!  malloc failed in malloc_block()
Out of memory!
Ouch!  malloc failed in malloc_block()
Out of memory!
Ouch!  malloc failed in malloc_block()
Out of memory!

I wasn't running top at the time. 

BTW it's running redhat 7.0, 2 * 600 PIII with 256 MB, mysql 
3.22.27, Apache 1.3.14, mod_perl 1.24_01 Alll with just standard 
installations. I haven't tweaked anything.

Any help would be appreciated.

regards

Scott
_____
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Re: Too many connections with DBI

2001-01-10 Thread Scott Alexander

Hi,

Why do I see this in the log 

13402 Apache::DBI need ping: yes
13402 Apache::DBI new connect to 
'my_dbmy_usermy_passwdAutoCommit=1PrintError=1'

when I have in the startup.pl file

Apache::DBI-connect_on_init
 ("DBI:mysql:my_db",
  "my_user",
  "my_passwd",
  {
   PrintError = 1, # warn() on errors
   RaiseError = 0, # don't die on error
   AutoCommit = 1, # commit executes immediately
  }
 );

Is it because the child has reached it's maximum life ?

How many connections can you have open from DBI to mysql ?

I have 9 db's with 10 children ~ 90 connections .

All use the same user.

Should I increase the memory from 256 MB to ?

I have read http://perl.apache.org/guide/databases.html

Scott


_____
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Re: Help with Limit in Perl

2001-01-01 Thread Scott Alexander


I finally got it to work like it should.

Syntax I found in the archives even written by dougm was wrong. 

But after reading http://perl.apache.org/guide/config.html

it was written correctly.


My final question is: Is it possible to have the name of the 
REMOTE_USER in the httpd.conf file?

ie 

$user = $ENV{REMOTE_USER} ;
my $location = "/users/". $user ;
my $require = "user " . $user ;

Scott

Perl
#!perl

$Location {"/users/supervisor"} = {
  DAV = 'On',
  AllowOverride = 'None',
  Options = 'None',
  AuthName = 'Test',
  AuthType = 'Basic',
  Auth_MySQL_Password_Table = 'users',
  Auth_MySQL_Username_Field = 'user',
  Auth_MySQL_Password_Field = 'passwd',
  Auth_MySQL_Encryption_Types = 'Plaintext',
  Auth_MYSQL = 'on',
  Limit = {
METHODS = 'GET POST PUT DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK',
Require = 'user alexsc01',
  },
} ;
__END__
/Perl
--- End of forwarded message ---
_____
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Re: Help with Limit in Perl

2001-01-01 Thread Scott Alexander

On 1 Jan 2001, at 11:40, James G Smith wrote:

Thanks for the answer. I'm no mod_perl or apache guru but I had a 
feeling it didn't make sense.

I'm trying to use a Apache::AuthAnyModDav to authenticate for 
mod_dav.

I already have a Apache::AuthAny for normal authentication which 
works fine.

I'd like to have it so a user can use Web folders in Win 98 and 
connect to a directory on the web server. But only their own 
directory. I can get it to work via authentication but that is any user 
can access any directory in the tree. I want that they can only 
access their own directory. 

At the moment users can upload, download to their own directory via 
a html interface but to add WebDav functionality would be great!

regards

Scott

 Short answer: no.
 
 Long answer: Since the httpd.conf file is read only at startup 
 (or other well defined times, such as a HUP signal), which 
 REMOTE_USER would you have in mind?  Mod_perl feeds any 
 information from the perl sections into the httpd configuration 
 engine at the time the conf file is read.  Any variable 
 substitutions get made at that time.
 +-
 James Smith - [EMAIL PROTECTED] | http://www.jamesmith.com/
 [EMAIL PROTECTED] | http://sourcegarden.org/
   [EMAIL PROTECTED]  | http://cis.tamu.edu/systems/opensystems/
 +--


_
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Help with Perl in httpd.conf

2000-12-31 Thread Scott Alexander

Hi,

I have the following in my httpd.conf file but the Limit is having no 
effect. Running perl -cx httpd.conf tells me I've got a syntax error on 
the limit line.

Any help ? 

I haven't included all the lines in the Perl section. 

It would be great if I got this to work before next year ;)

regards

Scott

Perl
#!perl

$Location {"/users/supervisor"} = {
  Limit = {"GET POST PUT DELETE "} = {
Require = 'supervisor',
  },
} ;
__END__
/Perl
_____
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Help with Perl in httpd.conf

2000-12-31 Thread Scott Alexander

After searching the archives (I searched on Limit not on Perl 
like the  first time) I've changed my code to

But the limit does not work properly. I get a Directory index 
forbidden by rule: /usr/local/apache/htdocs/users/supervisor/
in the error log. 

Is the syntax still wrong or does anyone have any ideas about this?

Scott

Perl
#!perl

$Location {"/users/supervisor"} = {
  DAV = 'On',
  AllowOverride = 'None',
  Options = 'None',
  AuthName = '"Test"',
  AuthType = 'Basic',
  Auth_MySQL_Password_Table = 'users',
  Auth_MySQL_Username_Field = 'user',
  Auth_MySQL_Password_Field = 'passwd',
  Auth_MySQL_Encryption_Types = 'Plaintext',
  Auth_MYSQL = 'on',
  Limit = {
METHODS = `GET POST`,
require = `user supervisor`,
  },
} ;
__END__
/Perl
_____
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Help with Limit in Perl

2000-12-31 Thread Scott Alexander

Hi,

I've looked thru the archives and suggestions posted earlier do not 
help.

My code is at the moment like this:
Perl
#!perl
$Location {"/users/supervisor"} = {
  DAV = "On",
  AllowOverride = "None",
  Options = "None",
  AuthName = "Test",
  AuthType = "Basic",
  Auth_MySQL_Password_Table = "users",
  Auth_MySQL_Username_Field = "user",
  Auth_MySQL_Password_Field = "passwd",
  Auth_MySQL_Encryption_Types = "Plaintext",
  Auth_MYSQL = "on",
  Limit = {
'METHODS' = "GET", 'Require' = "valid-user",
#'METHODS' = "POST", 'Require' = "valid-user",
},
} ;
__END__
/Perl

If I uncomment the last methods line then it doesn't work at all. But 
with only one methods line like it is now it works. 

How do I use 

Apache-httpd_conf ?

regards

Scott
_
scott alexander
tietoverkkosuunnittelija
humak amk - finland
+358(0)407505640



Re: learning for someone like me

2000-11-19 Thread Scott Alexander

On 19 Nov 2000, at 9:05, quagly wrote:

 This book looks great!  I had seen it before, but assumed that it was all
 C.
 
 Thanks for the tip.
 
 ~quagly
 
I was thinking along the same line. The title of the book doesn't do 
it justice. I checked out the book from oreilly's after reading a 
response to this thread. I should have bought this book along time 
ago!

Who chose the title for this book?

Scott
__
scott alexander
humak amk - humak poly technic
tietoverkkosuunnittelija
software developer
+358 (0)40 7505640

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




hashes and mod_perl

2000-10-31 Thread Scott Alexander

Hi,

Is it possible using the magic of mod_perl to set a hash array available for all 
scripts without each script having to open the dbm file.

eg Each of my scripts tie a dbm file to a hash array (%output). (about 600 
elements)

In some of my scripts I'm using functions recursively. Passing %output to a 
function will work once put when it goes very deep recursively it doesn't work.

Anyway the orginal question is can I set the hash_array value at start up time 
and then access them from all scripts?

Thanks in advance. 




Re: hashes and mod_perl

2000-10-31 Thread Scott Alexander



 Hi there,
 
 On Tue, 31 Oct 2000, Scott Alexander wrote:
 
  Is it possible using the magic of mod_perl to set a hash array
  available for all scripts without each script having to open the dbm
  file.
 
 It's not really a mod_perl specific problem.  You need to take care of
 the possibility that there will be conflicts between processes trying
 to write to the same file, so you need to implement some sort of
 locking.  It's in the Guide http://perl.apache.org/guide.

I'm using the hash to store different output languages and is only 
ever updated by one person. 100% of the time it's being read.

  
  In some of my scripts I'm using functions recursively. Passing
  %output to a function will work once put when it goes very deep
  recursively it doesn't work.
 
 Pass a reference.
 
 my $rhash = \%output;
 my $result = func( $rhash );

Okay this solves my problem that I had.

 
 $rhash _could_ be a global, but don't go there...



Is it in anyway possible to tie the hash once to a dbm file?

At the moment it is tied every time a script is called. 

Does the line $test = dbmopen(%output, "/my.dbm", 0600) ; on 
every script cause much work?

Scott

 
 73,
 Ged.





Re: Best book

2000-07-11 Thread Scott Alexander

I used the eagle book.  I have done very well with it.  Are there 
really any other books out there on the subject?

Scott
On 11 Jul 2000, at 10:22, Pramod Sokke wrote:
 Any ideas on which is the best book available out there for mod_perl?





Re: Apache/mod_perl

2000-07-07 Thread Scott Alexander

So if i didn't want to wait,  how would I go about getting an RSA 
liscense? to have a mod_ssl server before then.

Also,  are the CA's willing to sign for this time of server?

Scott
On 7 Jul 2000, at 11:34, Rob Tanner wrote:
 If you can patiently wait till September 21 when the RSA patents expire
 covering the SSL algorithms, then you can use mod_ssl without fear of
 patent violations or lawsuits.





Re: Apache/mod_perl

2000-07-07 Thread Scott Alexander

The issue has less to do with the cost of the whole thing, then with 
Strong hold having horrible support as well as a laundry list of other 
problems.  

Our as we convert our code base into completely mod_perl 
modules, the stronghold 2.4.2 has to be replaced by either 3.x or 
going to some other solutions based on apache/mod_perl/ssl 
component. Stronghold on solaris won't run the perlhandler that we 
want it to. 
The question were facing is whether it is worth it to go after the 3.x 
upgrade for strong hold or some other route.

I'm going to try the raven 30day trial and see if i can make that 
work the way we want it to.

Scott

On 7 Jul 2000, at 16:42, Vivek Khera wrote:
 You don't get a license from RSA cheaply.  This is why you buy
 Stronghold or Raven or some equivalent.  The cost of Stronhold and
 Raven is not that much in the grand scheme of things if you have stuff
 important enough to be protecting with SSL in the first place





Re: Browser Sniffing

2000-06-29 Thread Scott Alexander

Looking at this,  I'm tempted to do a similar thing.  My thought was 
to take the code and then twist it slightly to put the information into 
a database.  ie when I create a new session,  grab the information 
about browser etc.

Would save me a bit if it were already a completed apache:: 
module but if not.  I'll do it probably within the next three weeks.

Scott
On 29 Jun 2000, at 16:35, Drew Taylor wrote:
 Next question, what if this was turned into a proper Apache module and
 run as the PerlFixupHandler. It could put the sniffer results into
 $r-notes entries, which could then be used where ever needed. I'll
 assume it would just return DECLINED so the standard handlers will be
 run.





Re: using a module to contain settings.

2000-06-23 Thread Scott Alexander

On 22 Jun 2000, at 17:51, Perrin Harkins wrote:
 On Thu, 22 Jun 2000, Scott Alexander wrote:
  I then have an Initialize_globals function that I run to reset all the
  variables at the begining of a request.
 Why would you reset all of your configuration globals at the beginning of
 a request?
Safety more then anything else.  This just makes sure that If 
anything gets changed in the previous request,  it doesn't affect the 
other requests.
 
  I thought I should be able to access them using
  $Mf7::Globals::imgserver but this just errors out with unitialized
  variable.
 That should work.  Maybe you could post a little code snippet?  You are
 using actual global variables in Mf7::Globals, right?
np. I removed everything but the imgserver variable out of it.  
otherwise it was/is pretty big.
package Mf7::Globals;
use strict;
use vars qw($VERSION);
my (
$imgserver,
);
$VERSION = '0.01';
sub Initialize_globals {
$imgserver = 'http://www.musiciansfriend.com';
}
1;
__END__
 
then a test i've been running:
#!/usr/local/bin/perl -w
use Mf7::Globals;
use strict;
Mf7::Globals::Initialize_globals();
print "$Mf7::Globals::imgserver\n";

This sends :
Use of uninitialized value in concatenation (.) 
at test.file line 5.


If it came down to it,  I can make the change as 
this code isn't near going live yet, but i'd 
prefer to keep them referenced this way since 
I've already made it through all the files(29) 
and updated all of them to be 
$Mf7::Globals::varname.

 Incidentally, the MF site is pretty fast.  Is it running on mod_perl now?
Yep. Mod_perl and Apache::Registry saved us from having to get a 
ton of new hardware.  I don't remember my exact benchmarks, but 
we were hitting huge loads on the code base before Mod_perl with 
just a couple of hits(it was in development, so we were just testing) 
 once we moved to mod perl,  we only had one real questionable 
time where our load hit 160.  Once we brought in the second box 
though,  our load has been nothing.

Scott




Re: using a module to contain settings.

2000-06-23 Thread Scott Alexander

On 23 Jun 2000, at 13:27, Perrin Harkins wrote:
 On Fri, 23 Jun 2000, Scott Alexander wrote:
 Okay, this is an easy one.  You are declaring $imgserver as a lexical (my)
 variable.  When Perl finishes executing this file, lexical variables go
 out of scope.  You can fix this by making it a real global like $VERSION,
 either with a use vars or with fully-qualified variable names.  You could
 still use lexicals if you create subroutine closures to provide access to
 them, but I think using globals is simpler.
ok.  switching them to a use vars section did the trick.

   Incidentally, the MF site is pretty fast.  Is it running on mod_perl now?
  Yep. Mod_perl and Apache::Registry saved us from having to get a 
  ton of new hardware.
 You should submit something for the "success stories" and "sites running
 mod_perl" pages on http://perl.apache.org/.  You might get a few free
 clicks for your trouble.
In the two months since we brought this site live,  the four of us 
doing the programming really haven't had enough time to do that.  
Hopefully we can get to posting a bit about it soon.

Scott



using a module to contain settings.

2000-06-22 Thread Scott Alexander

I'm working on creating a site that is completely done in mod perl.

The area that I'm running into problems with is using a single 
module to store configuration information. ie where images are 
stored. oracle settings, color codes etc.  All the settings that are 
valid accross the entire site.

The way i've been trying to do this is to create a module 
Mf7::Globals and then store the data inside.
I then have an Initialize_globals function that I run to reset all the 
variables at the begining of a request.

I thought I should be able to access them using 
$Mf7::Globals::imgserver but this just errors out with unitialized 
variable.

So what method are you guys using to store sitewide variables?

Scott



Best way?

2000-05-11 Thread Scott Alexander


Hi,

I have in every script

my $user_language = library::language($user, $dbh) ; 
# is it finnish, english or swedish
my %output = library::load_language($user_language) ; 
# ties %output to a dbm

%output holds all the different outputs needed for each language

then for my subs which are in a package library I pass a reference

library::menu($db, \%output) ; #passes a reference to sub menu

%output never gets modified only read. 

I am using mod_perl. Is this the most efficient way of doing things?

I discovered the mistake I had when I turned on use strict in my library 
package. Before this I didn't pass %output to each sub ... to be honest I really

didn't understand how each sub new the values in %output. After turning on use 
strict I had to pass \%output because %output was empty in the subs.

hope this makes sense.

Scott


Scott Alexander tietoverkkosuunnittelija
[EMAIL PROTECTED]
gsm: +358 (0)40 7505640



Using -w in a package

2000-05-10 Thread Scott Alexander

Hi,

I've used #!/usr/bin/perl -w in all of my scripts

but how can I use -w in a package ?

I have always declared variables with my in a sub but speling mistakes will 
happen. And I don't get any warnings. How can I do this?

regards and thanks in advance

Scott


Scott Alexander tietoverkkosuunnittelija
[EMAIL PROTECTED]
gsm: +358 (0)40 7505640



Setting AuthUserFile dynamically ...

2000-04-18 Thread Scott Alexander

Hi,

I asked yesterday about using httpd.conf to set the AuthUserFile dynamically.

Maybe I'm trying to paddle up a creek in a barb wire canoe.

Is it possible to do something like below? i.e. use a variable in the 
AuthUserFile line? Or how can I do this?

Directory /systems/v2.0
PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI

RewriteRule ^/bin/([^/]+)/(.*) /systems/v2.0/$2 [E=STATUS:$1] [PT]
 This line
AuthUserFile /systems/$1/passwd/users
 and this line
AuthName "$1"
AuthType Basic
require valid-user
Limit GET POST PUT DELETE
require valid-user
/Limit

ErrorDocument 401 /systems/v2.0/error/401.html
ErrorDocument 403 /systems/v2.0/error/403.html
ErrorDocument 404 /systems/v2.0/error/404.html
ErrorDocument 500 /systems/v2.0/error/500.html
/Directory

regards

Scott

--------
Scott Alexander tietoverkkosuunnittelija
[EMAIL PROTECTED]
gsm: +358 (0)40 7505640



dynamically set AuthUserFile

2000-04-17 Thread Scott Alexander

Hi,

I'm using part of the URL to tell perl::dbi what DB to connect to.

www.mysite.com/mydb/index.html

will connect to mydb.

I will be creating many different environments. At the moment I edit the 
httpd.conf file as I add each environment.

How can I tell apache what AuthUserFile to use dynamically?
And set AuthName dynamically?

Any help or pointers in the right direction will be very much appreciated.

regards

Scott



Scott Alexander tietoverkkosuunnittelija
[EMAIL PROTECTED]
gsm: +358 (0)40 7505640