You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by KartheeK <ka...@yahoo.co.in> on 2005/11/17 08:41:26 UTC

Preestablish database connection during httpd process startup--HOWTO??

Hello Everybody,  
I am Using a Trouble ticketing System- OTRS it is running on mod_perl, I am trying to configure " Preestablish datababase connections" During httpd process startup: 
I have configured the "apache2-perl-startup.pl" as follows: 
==================================== 
use Apache (); 
use Apache::DBI (); 
Apache::DBI->connect_on_init('DBI:mysql:otrs::localhost',"otrs","hot"); 
use DBI (); 
use DBD::mysql (); 
==================================== 
But, on doing this my httpd server doesn’t start and I get the following error: 

****************ERROR---1******************************* 
Can't locate Apache.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . /etc/httpd) at /opt/otrs/scripts/apache2-perl-startup.pl line 22.\nBEGIN
 failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 22.\nCompilation failed in require at (eval 2) line 1.\n 

[Wed Nov 16 12:03:30 2005] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server mercury.envisionone.net:0, exiting... 
****************ERROR---1*************************** 

Therefore I Included the file Apache.pm 
From: 
“/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/DBI/ProfileDumper/Apache.pm” 
To: “/opt/otrs” 

Now, I get another Error 
*********************ERROR---2********************** 
[Wed Nov 16 12:13:38 2005] [error] Can't locate Apache/DBI.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . /etc/httpd) at
 /opt/otrs/scripts/apache2-perl-startup.pl line 23.\nBEGIN failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 23.\nCompilation failed in require at (eval 2) line 1.\n 
[Wed Nov 16 12:13:38 2005] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server mercury.envisionone.net:0, exiting... 
*******************ERROR---2****************** 
However, 
==================================== 
#use Apache (); 
#use Apache::DBI (); 
#Apache::DBI->connect_on_init('DBI:mysql:otrs::localhost',"otrs","hot"); 
use DBI (); 
use DBD::mysql (); 
==================================== 
Works without any problem. 

Am I wrong in the configuration?? Anybody with success in this?
   
  Regards
  KartheeK 

		
---------------------------------
 Enjoy this Diwali with Y! India Click here

Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by Perrin Harkins <pe...@elem.com>.
KartheeK wrote:
> Meanwhile, I tried the same thing on a Mandrake-10.1, And Guess What!!! 
> No Errors in my httpd logs.....

It sounds like you are using RPMs for mod_perl and the application you 
have is written for a specific version which is not the one on your Red 
Hat system.

> Now, the question is How Can I *prove my 
> Boss* and to myself that I have established mysql connection during 
> httpd process start up....

Just read the documentation for Apache::DBI.  It tells you how to turn 
on the DEBUG setting which will print what you need to the error_log.

>    1. I tried this,
>    2. I stopped mysql server
>    3. I Restarted httpd server, but surprizingly it came up without any
>       problem

Connections are not made during the server startup, but rather when a 
child process is forked.  You will probably find errors in the log from 
when it tried to fork a child.

- Perrin

Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by KartheeK <ka...@yahoo.co.in>.
Ooops, ignore the other mail, I replied to a wrong one, here goes the right one:
     
   
  Hi, 
  Meanwhile, I tried the same thing on a Mandrake-10.1, And Guess What!!! No Errors in my httpd logs..... Now, the question is How Can I prove my Boss and to myself that I have established mysql connection during httpd process start up....
  is there any way??
    
   I tried this,   
   I stopped mysql server   
   I Restarted httpd server, but surprizingly it came up without any problem, ideally it should have thrown out a error so as to say that It could not establish a connection with mysql(since the server is down)
  What should I conclude, Am I successfull In establishing the connection?? 
   
  Regards
  KartheeK


Perrin Harkins <pe...@elem.com> wrote:
  On Thu, 2005-11-17 at 07:41 +0000, KartheeK wrote:
> I am Using a Trouble ticketing System- OTRS it is running on mod_perl,
> I am trying to configure " Preestablish datababase connections" During
> httpd process startup

Okay. Are connections working when you don't try to use connect_on_init
()? What version of mod_perl are you using? Please include the
information requested here:
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

> I have configured the "apache2-perl-startup.pl" as follows: 
> ==================================== 
> use Apache (); 

Why did you do that? I don't think there's ever a need to explicitly
"use Apache".

> Can't locate Apache.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-
[...]
> Therefore I Included the file Apache.pm 
> From: 
> “/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-
> multi/DBI/ProfileDumper/Apache.pm” 
> To: “/opt/otrs” 

No! You can't just copy ANY file named Apache.pm there. It is looking
for a specific thing.

It looks to me like this whole installation is messed up. Does it work
for you aside from this one thing?

- Perrin

  


		
---------------------------------
 Enjoy this Diwali with Y! India Click here

Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2005-11-17 at 07:41 +0000, KartheeK wrote:
> I am Using a Trouble ticketing System- OTRS it is running on mod_perl,
> I am trying to configure " Preestablish datababase connections" During
> httpd process startup

Okay.  Are connections working when you don't try to use connect_on_init
()?  What version of mod_perl are you using?  Please include the
information requested here:
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

> I have configured the "apache2-perl-startup.pl" as follows: 
> ==================================== 
> use Apache (); 

Why did you do that?  I don't think there's ever a need to explicitly
"use Apache".

> Can't locate Apache.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-
[...]
> Therefore I Included the file Apache.pm 
> From: 
> “/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-
> multi/DBI/ProfileDumper/Apache.pm” 
> To: “/opt/otrs” 

No!  You can't just copy ANY file named Apache.pm there.  It is looking
for a specific thing.

It looks to me like this whole installation is messed up.  Does it work
for you aside from this one thing?

- Perrin


Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by Frank Wiles <fr...@wiles.org>.
On Fri, 18 Nov 2005 06:29:40 +0000 (GMT)
KartheeK <ka...@yahoo.co.in> wrote:

> Hi Frank,
>   I tried But I get this:
>   =========================================================
>   [Fri Nov 18 11:41:11 2005] [error] Can't locate Apache/DBI.pm in
> @INC (@INC
> contains: /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . /etc/httpd)
> at /opt/otrs/scripts/apache2-perl-startup.pl line 28.\nBEGIN
> failed--compilation aborted
> at /opt/otrs/scripts/apache2-perl-startup.pl line 28.\nCompilation
> failed in require at (eval 2) line 1.\n [Fri Nov 18 11:41:11 2005]
> [error] Can't load Perl
> file: /opt/otrs/scripts/apache2-perl-startup.pl for server
> srocotrs.envisionone.net:0, exiting...
> =========================================================== 

  Do you have Apache::DBI installed in one of those directories 
  listed in the error? 

 ---------------------------------
   Frank Wiles <fr...@wiles.org>
   http://www.wiles.org
 ---------------------------------


Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by KartheeK <ka...@yahoo.co.in>.
Hi Frank,
  I tried But I get this:
  =========================================================
  [Fri Nov 18 11:41:11 2005] [error] Can't locate Apache/DBI.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . /etc/httpd) at
 /opt/otrs/scripts/apache2-perl-startup.pl line 28.\nBEGIN failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 28.\nCompilation failed in require at (eval 2) line 1.\n
[Fri Nov 18 11:41:11 2005] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server srocotrs.envisionone.net:0, exiting...
===========================================================
   
  

Frank Wiles <fr...@wiles.org> wrote:
  On Thu, 17 Nov 2005 07:41:26 +0000 (GMT)
KartheeK wrote:

> Hello Everybody, 
> I am Using a Trouble ticketing System- OTRS it is running on
> mod_perl, I am trying to configure " Preestablish datababase
> connections" During httpd process startup: I have configured the
> "apache2-perl-startup.pl" as follows:
> ==================================== use Apache (); use Apache::DBI
> (); Apache::DBI->connect_on_init
> ('DBI:mysql:otrs::localhost',"otrs","hot"); use DBI (); 
> use DBD::mysql (); 
> ==================================== 
> But, on doing this my httpd server doesn’t start and I get the
> following error: 
> 
> ****************ERROR---1******************************* 
> Can't locate Apache.pm in @INC (@INC

Try it without the "use Apache ();" line, but leave the others in. 

---------------------------------
Frank Wiles 
http://www.wiles.org
---------------------------------

  


		
---------------------------------
 Enjoy this Diwali with Y! India Click here

Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by Enno <bu...@xs4all.nl>.
and you might want to change your database password too. we all have it
now...

Enno

On Thu, 17 Nov 2005, Frank Wiles wrote:

> On Thu, 17 Nov 2005 07:41:26 +0000 (GMT)
> KartheeK <ka...@yahoo.co.in> wrote:
>
> > Hello Everybody,
> > I am Using a Trouble ticketing System- OTRS it is running on
> > mod_perl, I am trying to configure " Preestablish datababase
> > connections" During httpd process startup: I have configured the
> > "apache2-perl-startup.pl" as follows:
> > ==================================== use Apache (); use Apache::DBI
> > (); Apache::DBI->connect_on_init
> > ('DBI:mysql:otrs::localhost',"otrs","hot"); use DBI ();
> > use DBD::mysql ();
> > ====================================
> > But, on doing this my httpd server doesn�t start and I get the
> > following error:
> >
> > ****************ERROR---1*******************************
> > Can't locate Apache.pm in @INC (@INC
>
>   Try it without the "use Apache ();" line, but leave the others in.
>
>  ---------------------------------
>    Frank Wiles <fr...@wiles.org>
>    http://www.wiles.org
>  ---------------------------------
>
>
>


Re: Preestablish database connection during httpd process startup--HOWTO??

Posted by Frank Wiles <fr...@wiles.org>.
On Thu, 17 Nov 2005 07:41:26 +0000 (GMT)
KartheeK <ka...@yahoo.co.in> wrote:

> Hello Everybody,  
> I am Using a Trouble ticketing System- OTRS it is running on
> mod_perl, I am trying to configure " Preestablish datababase
> connections" During httpd process startup: I have configured the
> "apache2-perl-startup.pl" as follows:
> ==================================== use Apache (); use Apache::DBI
> (); Apache::DBI->connect_on_init
> ('DBI:mysql:otrs::localhost',"otrs","hot"); use DBI (); 
> use DBD::mysql (); 
> ==================================== 
> But, on doing this my httpd server doesn’t start and I get the
> following error: 
> 
> ****************ERROR---1******************************* 
> Can't locate Apache.pm in @INC (@INC

  Try it without the "use Apache ();" line, but leave the others in. 
  
 ---------------------------------
   Frank Wiles <fr...@wiles.org>
   http://www.wiles.org
 ---------------------------------