Apache-DBI
view release on metacpan or search on metacpan
This way all modules are pulled into the main httpd process. When the main
process forks his children, the code of all modules is already in place and
the database handle will also be initiated.
WARNING: Do not attempt to open a persistent database connection in the parent
process (via PerlRequire or PerlModule). If you do, children will get a copy
of this handle, causing clashes when the handle is used by two processes at
the same time. Each child must have it's own unique connection handle. For
the same reason it is not possible, to share one database handle between all
servers using some IPC mechanism.
If you want to make sure that the module works correctly, turn on debugging
as described below and search for 'Apache::DBI' in the output. You should
get one 'new connect' message for every server process. Any subsequent request
should result in a 'already connected' message. Please keep in mind, that
server processes may be killed as well as newly created depending upon your
configuration and depending upon your load. Every new server process needs to
do its own initial database connect.
Another useful method for enhancing the performance is to enable the caching in
AuthDBI setting Auth_DBI_cache_time > 0 and to use shared memory for the cache
(see the module documentation for details). This will reduce the database load
considerably.
COPYRIGHT:
----------
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the Perl README file.
PREREQUISITES:
--------------
Configure mod_perl1 with:
perl Makefile.PL PERL_CHILD_INIT=1 PERL_AUTHEN=1 PERL_AUTHZ=1
PERL_CLEANUP=1 PERL_STACKED_HANDLERS=1
If there are no security reasons to limit the API, just use EVERYTHING=1.
mod_perl2 RC5 and higher should work with Apache::DBI 0.96 and higher.
No specific switches must be passed to mod_perl2's Makefile.PL.
INSTALLATION:
-------------
perl Makefile.PL
make
make test # only works with MySQL so far; patches welcome
make install
IF YOU HAVE PROBLEMS:
---------------------
Please read the README and the the module documentation: 'perldoc Apache::AuthDBI',
'perldoc Apache::DBI'.
Please verify your setup: turn on debug output and compare it to traces.txt.
If you have problems with persistent database connections, verify that everything
works correct without using Apache::DBI.
Before sending a bug report it might be useful to look at the debug output.
To enable full debug output set the following variables in startup.pl or in your
perl script:
$Apache::DBI::DEBUG = 2;
$Apache::AuthDBI::DEBUG = 2;
and watch the error_log. Compare the output to the traces in traces.txt.
If this doesn't help, please send an email to <modperl@apache.org> and include
the following information in your bug-report:
- debug output,
- output of perl -V,
- version of ApacheDBI,
- version of DBI,
- used database
A common problem is an error-message that $dbh will not stay shared. A
complete explanation for this behavior is given in the modperl-FAQ. In
short, instead of this:
my $dbh = ...;
subroutine();
sub subroutine {
$dbh->....
}
do this:
my $dbh = ...;
subroutine($dbh);
sub subroutine {
my $dbh = shift;
$dbh->....
}
FURTHER INFORMATION:
--------------------
mod_perl by Doug MacEachern modperl-subscribe@perl.apache.org
http://perl.apache.org/
DBI by Tim Bunce dbi-users-subscribe@perl.org
http://dbi.perl.org/
Apache by Apache Group news:comp.infosystems.www.servers.unix
users-subscribe@httpd.apache.org
http://httpd.apache.org/
---------------------------------------------------------------------------
Edmund Mergl <E.Mergl@bawue.de>
Ask Bjoern Hansen <ask@develooper.com>
( run in 1.937 second using v1.01-cache-2.11-cpan-39bf76dae61 )