Initializing CGI Object from $r

2001-04-21 Thread Wade Burgett

Can I initilize a new CGI object just by passing in a request from a
handler?
ie

sub handler {

my $r = shift;
my $CGIQuery = new CGI($r);


};





Re: mod_php mod_perl install with apache problems - same story :(

2001-03-01 Thread Wade Burgett

This is probably what you need more or less.  You have to tell Apache what
files are your mod perl scripts (or more specifically what files you want
handled by Apache::Registry - the persistent cgi program module).

Alias /perl/ /home/httpd/perl/
  PerlModule Apache::Registry
  Location /perl
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
allow from all
PerlSendHeader On
  /Location

http://perl.apache.org/guide/config.html is the configuration portion of a
great guide by Stas Berkman that has this information in it.  The O'Reilly
book Building Apache Modules with Perl and C has some instructions about
this as well.  Recommened.

Wade




- Original Message - 
From: "Terry Davis" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 01, 2001 12:53 PM
Subject: mod_php mod_perl install with apache problems - same story :(


 Hello!
 
 Well, I have seen a ton of people with this problem but no answers.
 I have mod_php compiled in with apache along with mod_ssl.
 I want to use apxs to build mod_perl.  I have done this and apache
 starts fine, but it does not render the perl, for lack of better terms. 
 It simply prints the source.  The only directives i have in httpd.conf
 are LoadModule and DirectoryIndex.  When I start apache, apachectl
 startssl, the eror log says:
 Apache/1.3.17 (Unix) mod_perl/1.25 PHP/4.04 mod_ssl/2.8.0 OpenSSL/0.9.6
 configured -- resuming normal operations.
 This all looks fine.
 Anyone have any insight as to what my problem may be?
 
 Thank you!
 
 -- 
 Terry Davis
 Systems Administrator
 BirdDog Solutions, Inc.
 2102 N 117th Ave
 Omaha, NE 68164
 voice: (402) 829-6059
 fax: (402) 829-6199
 pager: (877) 973-6995
 [EMAIL PROTECTED] www.birddog.com
 




Probably off topic but 113 errors and Netcache

2001-02-14 Thread Wade Burgett

I've got a bunch of sites using cookies to authenticate and to pass some
(crypted) hashes around.  I've got one guy behind a "netcache" proxy
server (his cable modem provider apparently routes everyone through it)
gets a 113 error when trying to access one of my mod_perl scripts.  I
dont think this is a mod_perl problem at all, just something about the
proxy (everyone else is doing ok, even people behind other proxies-
however they are not in an http-accel mode proxying).

I'm trying to find an answer on the web, but I keep getting all these
server logs and error pages and such making narrowing the search alot
harder.

I have this horrible feeling this question is covered somewhere that
I should now about :)  but I cant seem to find it.  Suggestions on a
better place to ask this question are welcome.

Here is the error message from an ie5.5 win2k browser, but the source
shows a NetCACHeError as a commnet, which makes me almost certian its
coming from the proxy

ERROR: The requested URL could not be retrieved



While trying to retrieve the URL: UNKNOWN URL PERSISTENT

The following error was encountered:

ERROR 113 -- The syntax for the URL you entered is not valid.
This means that:

You made a typing error or the URL you entered might not follow the
rules for the syntax of URLs. Please reenter the URL in the correct
form.


--
Wade Burgett
Burgett Systems
http://www.burgettsys.com/
[EMAIL PROTECTED]





Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Wade Burgett

This is working for me.  I do some aliasing of mod_perl directories outside
of the perl section for stuff that all my hosts need to share so my httpd.conf
is not all perl, but I do have some aliasing going on.

There's some stuff there to pull my records out of a database but basically
the $Company hash_ref is for each company I host.


Perl
use Asql::utility;
use Apache::PerlSections();
my $statement = "select ID,Company,webhost,rootdir,master_user,domain,rt from
Companies where webhost is not  NULL and master_user is not NULL";
my $dbh = connect_system_db();
my $sth = $dbh-prepare($statement)|| die "$DBI::errstr\n";
$sth-execute()|| die "$DBI::errstr\n";
my $counter = 0;

while ($Company = $sth-fetchrow_hashref()){

$$Company{ServerAdmin} = "$$Company{master_user}\@"."$$Company{domain}";
my $statement = "select Domain from domains where CompanyID=?";
my $sth2 = $dbh-prepare($statement)|| die "$DBI::errstr\n";
$sth2-execute($$Company{ID})|| die "$DBI::errstr\n";
my $othersites = $sth2-fetchall_arrayref;
@$othersites = map {$_="www.$_";} @$othersites;
#build the hosts

$VirtualHost{'192.168.0.50:80'}[$counter] = {
 SSLDisable   = '',
 ServerName   = "$$Company{webhost}",
 DocumentRoot = "$$Company{rootdir}/public_html",
 ErrorLog = "$$Company{rootdir}/log/error.log",
 CustomLog  = "$$Company{rootdir}/log/access.log combined",
 ServerAdmin  = "$$Company{ServerAdmin}",
 CheckSpelling = 'on',
 "ErrorDocument 404" = "/errors/404.shtml",
 Alias = ["/webrt" = "/var/burgettsys/rt/lib/images"],
 ScriptAlias = ["/rt" = "$$Company{rootdir}/rt/bin/cgi/"],
 ServerAlias = $othersites,
};
$counter++;
};

#print STDERR Apache::PerlSections-dump();
__END__

/Perl



Dave Baker wrote:

  Has anyone successfully built a fully perl conf file with multiple virtual
  hosts on the same IP?  I'm giving it my best, but just can't quite get it to
  work.  I'm stuck on aliases.  The Eagle book and the mod_perl guide have
  both been of great help getting this far, but I can't find an example of
  setting anything where "Directive is Repeated Multiple Times" (which may be
  an indication that it just don't work).

 Not a direct answer, but an alternative to fighting with the data
 structure is just just plug a programmatic $PerlConfig .= $string and
 build the VirtualHosts as if they were plain text.

 Not as elegant as doing this the hard way, but it's also easier to
 explain if you have to hand the config file off to someone who knows
 Apache but not Perl.

 Dave

 --

 -  Dave Baker  :  [EMAIL PROTECTED]  :  [EMAIL PROTECTED]  :  http://dsb3.com/
 GnuPG: 1024D/D7BCA55D / 09CD D148 57DE 711E 6708  B772 0DD4 51D5 D7BC A55D

   
Part 1.2Type: application/pgp-signature

--
Wade Burgett
Burgett Systems
http://www.burgettsys.com/
[EMAIL PROTECTED]






ecommendations for secured file and mod_perl

2001-02-07 Thread Wade Burgett

 My basic problem is that I need for mod_perl scripts to get to a
database password and an encryption key.  I would like to be able to
store these in a file not-readable by the apache user.  I've got them
out of the web tree already, but I would really like to make them
inaccessable to the web-server  user period.  I'm really just looking
for some thoughts as to how/where I could store these safely.  Its only
a couple strings.

One idea I am starting to tinker with, and will, as soon as my
isp gets the router rebooted :)
If I have a module that gets loaded by my startup.pl script (with use
myModule statement) is that happening as root?, or as the web-server
user?  This would be my specific question.  I am thinking that having
the module read the values from a config file and make them globals for
the module.  That seems like it should work.

I understand that mod_perl couldn't be setuid'd since it runs as
part of the apache process.Not sure how else to access files you
don't want the web server user to read.  Thats what I would have done
before becoming moded (and now I can't seem to stand not having
persistent db connections and that massive speed boost of Registry
anymore).   Any thoughts/links/etc would be useful.


--
Wade Burgett
Burgett Systems
http://www.burgettsys.com/
[EMAIL PROTECTED]