here is my problem:
I cannot, simply *cannot*, get connect_on_init to run on my mod_perl -> SQL database. (Apache 2.0.52)
here's the project's life story:
1. have perl script hit by many users.
2. want to 'precompile it'.
3. fix it up for mod_perl.
4. enable mod_perl (1.9916) on server, run it in mod perl.
5. Apache::DBI into the httpd.conf.
5b. code starts not being able to connect to DB every onece in a while.
6. "hey, you should have connect_on_init in your startup file!"
7. "Apache.pm was not loaded at startup.pl line 28".
And there we are. Nothing I've tried has gotten this to work, and I've been hacking at it for *days*.
Now, old perlmonks threads have said to upgrade to modperl2, but Apache::DBI "has only been tested "very lightly". and it would also require the Apache2::compat module. So I'm wary.
QUESTION: Should I upgrade? if so, what should I expect? the only thing my server uses on mod_perl now is a test file, the rest is all CGI. If there is an easy fix (to the 'get dbi to connect' issue), I'd rather not upgrade, just for ease of implementation.
I'm right here at console, so if anyone can help, maybe "hey Mash, have you tried this?", you'd be a lifesaver. Thanks in advance.
update: startup code:
#!/usr/local/bin/perl -w
$ENV{MOD_PERL} or die "GATEWAY_INTERFACE not Perl!";
use Apache::DBI;
use strict;
Apache::DBI->connect_on_init('DBI:mysql:database=dbname;host=localhost
+','dbuser','',{ PrintError => 1, RaiseError => 0, AutoCommit => 1});
+### THIS IS LINE 28 WITH NAMES / PWDS TAKEN OUT
Apache::DBI->setPingTimeOut('DBI:mysql:dbname', 0);
1;
I don't want to update, but, getting this Apache::DBI to work seems impossible where I'm at. If I'm missing something, neither I nor my server techs can find it..