Re: Trouble getting mod_perl and apache running with Apache::DBI
On Sun, 2003-08-17 at 11:41, Perrin Harkins wrote: On Fri, 2003-08-15 at 10:34, K Old wrote: What's happening is that with use Apache::DBI uncommented in either the httpd.conf or startup.pl Apache does not start. Do you have something in your code that connects to a database during startup? That could be a problem. Also, what's the point of use vars qw($dbh %session); in your startup.pl? Do you actually know what package these are being declared in? Probably not one that you will be using later in your scripts. - Perrin Hello everyone, Just wanted to post the solution I ran across so that others have a resource (and when I forget again, I'll have somewhere to look ;) My problem was that I was not declaring PerlModule Apache::DBI in httpd.conf BEFORE my PerlRequire /etc/httpd/conf/startup.pl. Also, I was doing a use Apache::DBI in my startup.pl file, which I shouldn't have done. Hope this helps someone, Kevin -- K Old [EMAIL PROTECTED] -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Trouble getting mod_perl and apache running with Apache::DBI
On Mon, 2003-08-18 at 11:33, K Old wrote: My problem was that I was not declaring PerlModule Apache::DBI in httpd.conf BEFORE my PerlRequire /etc/httpd/conf/startup.pl. Also, I was doing a use Apache::DBI in my startup.pl file, which I shouldn't have done. Sorry, that is not correct. It's fine to do PerlModule Apache::DBI or do a use Apache::DBI in startup.pl. You should not do both of them, and you should make sure you load Apache::DBI in one of these ways before loading anything that uses DBI. This is all in the Apache::DBI documentation. - Perrin -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Trouble getting mod_perl and apache running with Apache::DBI
On Fri, 2003-08-15 at 10:34, K Old wrote: What's happening is that with use Apache::DBI uncommented in either the httpd.conf or startup.pl Apache does not start. Do you have something in your code that connects to a database during startup? That could be a problem. Also, what's the point of use vars qw($dbh %session); in your startup.pl? Do you actually know what package these are being declared in? Probably not one that you will be using later in your scripts. - Perrin -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Trouble getting mod_perl and apache running with Apache::DBI
Hello everyone, I've set mod_perl up with Apache::DBI on several servers, both with mod_perl from RPM's and building it myself, but I am having a horrible time with a new server I've just built. Go easy, I'm still new at it, though. And I welcome any and all constructive criticism for my config files, etc. Here are the specs: RH 7.3, mod_perl 1.2.6 from RPM, Apache::DBI 0.92, DBI 1.37. Now, here's what I'm defining in httpd.conf: snip httpd.conf IfModule mod_perl.c Alias /perl /var/www/perl Directory /var/www/perl SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI /Directory #PerlHandler HTML::Mason::ApacheHandler PerlSetVar MasonCompRoot /var/www/html/mason PerlSetVar MasonDataDir /var/mason PerlSetVar MasonAllowGlobals $dbh #PerlAddVar MasonAllowGlobals $session #PerlAddVar MasonAllowGlobals %session #PerlAddVar MasonAllowGlobals $sys #PerlSetVar MasonRequestClass MasonX::Request::WithApacheSession #PerlSetVar MasonSessionClass Apache::Session::File #PerlSetVar MasonSessionDirectory /tmp/sessions #PerlSetVar MasonSessionLockDirectory /tmp/sessions PerlSetEnv DBI_TRACE 3=/tmp/dbitrace.log PerlRequire /etc/httpd/conf/startup.pl #PerlModule Apache::DBI AddType text/html .mhtml AddType text/html .mason Location /mason SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler Options +ExecCGI /Location /IfModule /snip httpd.conf Here's my startup.pl: snip startup.pl #!/usr/bin/perl use warnings; use strict; # Extend @INC if needed #use lib qw(/dir/foo /dir/bar); use lib qw(/var/www/html/mason/lib); use lib qw(/var/www/html/mason/hrtime/lib); use vars qw($dbh %session); # Make sure we are in a sane environment. $ENV{MOD_PERL} or die not running under mod_perl!; # For things in the /perl URL use Apache::Registry; #$KO::server_root = /var/www/html/mason/db; #use KO::DBI::Connect qw(:all); # Load Perl modules of your choice here # This code is interpreted *once* when the server starts use LWP::UserAgent (); #use Apache::DBI (); use DBI(); # Tell me more about warnings use Carp(); $SIG{__WARN__} = \Carp::cluck; # Load CGI.pm and call its compile() method to precompile # (but not to import) its autoloaded methods. use CGI (); CGI-compile(':all'); # Initialize the database connections for each child =pod Apache::DBI-connect_on_init (DBI:Pg:dbname=auth;host=localhost;port=5432, root,, { PrintError = 1, # warn() on errors RaiseError = 0, # don't die on error AutoCommit = 1, # commit executes immediately } ); =cut 1; /snip startup.pl What's happening is that with use Apache::DBI uncommented in either the httpd.conf or startup.pl Apache does not start. This is what error_log reports: [Thu Aug 14 14:59:49 2003] [notice] Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.7 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 mod_throttle/3.1.2 configured -- resuming normal operations [Thu Aug 14 14:59:49 2003] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Thu Aug 14 14:59:49 2003] [notice] Accept mutex: sysvsem (Default: sysvsem) [Fri Aug 15 10:08:43 2003] [notice] caught SIGTERM, shutting down When I try to pull up anything the connection is refused (because the server is down). I've just been commenting and uncommenting stuff until it worked. The weird thing is that there are no real error messages from mod_perl in the apache logs. Can anyone help? Thanks, Kevin -- K Old [EMAIL PROTECTED] -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: Trouble getting mod_perl and apache running with Apache::DBI
I left out my version of Perl. I'm using 5.6.1 from RPM. Kevin On Fri, 2003-08-15 at 10:34, K Old wrote: Hello everyone, I've set mod_perl up with Apache::DBI on several servers, both with mod_perl from RPM's and building it myself, but I am having a horrible time with a new server I've just built. Go easy, I'm still new at it, though. And I welcome any and all constructive criticism for my config files, etc. Here are the specs: RH 7.3, mod_perl 1.2.6 from RPM, Apache::DBI 0.92, DBI 1.37. Now, here's what I'm defining in httpd.conf: snip httpd.conf IfModule mod_perl.c Alias /perl /var/www/perl Directory /var/www/perl SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI /Directory #PerlHandler HTML::Mason::ApacheHandler PerlSetVar MasonCompRoot /var/www/html/mason PerlSetVar MasonDataDir /var/mason PerlSetVar MasonAllowGlobals $dbh #PerlAddVar MasonAllowGlobals $session #PerlAddVar MasonAllowGlobals %session #PerlAddVar MasonAllowGlobals $sys #PerlSetVar MasonRequestClass MasonX::Request::WithApacheSession #PerlSetVar MasonSessionClass Apache::Session::File #PerlSetVar MasonSessionDirectory /tmp/sessions #PerlSetVar MasonSessionLockDirectory /tmp/sessions PerlSetEnv DBI_TRACE 3=/tmp/dbitrace.log PerlRequire /etc/httpd/conf/startup.pl #PerlModule Apache::DBI AddType text/html .mhtml AddType text/html .mason Location /mason SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler Options +ExecCGI /Location /IfModule /snip httpd.conf Here's my startup.pl: snip startup.pl #!/usr/bin/perl use warnings; use strict; # Extend @INC if needed #use lib qw(/dir/foo /dir/bar); use lib qw(/var/www/html/mason/lib); use lib qw(/var/www/html/mason/hrtime/lib); use vars qw($dbh %session); # Make sure we are in a sane environment. $ENV{MOD_PERL} or die not running under mod_perl!; # For things in the /perl URL use Apache::Registry; #$KO::server_root = /var/www/html/mason/db; #use KO::DBI::Connect qw(:all); # Load Perl modules of your choice here # This code is interpreted *once* when the server starts use LWP::UserAgent (); #use Apache::DBI (); use DBI(); # Tell me more about warnings use Carp(); $SIG{__WARN__} = \Carp::cluck; # Load CGI.pm and call its compile() method to precompile # (but not to import) its autoloaded methods. use CGI (); CGI-compile(':all'); # Initialize the database connections for each child =pod Apache::DBI-connect_on_init (DBI:Pg:dbname=auth;host=localhost;port=5432, root,, { PrintError = 1, # warn() on errors RaiseError = 0, # don't die on error AutoCommit = 1, # commit executes immediately } ); =cut 1; /snip startup.pl What's happening is that with use Apache::DBI uncommented in either the httpd.conf or startup.pl Apache does not start. This is what error_log reports: [Thu Aug 14 14:59:49 2003] [notice] Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.7 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 mod_throttle/3.1.2 configured -- resuming normal operations [Thu Aug 14 14:59:49 2003] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Thu Aug 14 14:59:49 2003] [notice] Accept mutex: sysvsem (Default: sysvsem) [Fri Aug 15 10:08:43 2003] [notice] caught SIGTERM, shutting down When I try to pull up anything the connection is refused (because the server is down). I've just been commenting and uncommenting stuff until it worked. The weird thing is that there are no real error messages from mod_perl in the apache logs. Can anyone help? Thanks, Kevin -- K Old [EMAIL PROTECTED] -- K Old [EMAIL PROTECTED] -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html