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..
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.