askjoe has asked for the wisdom of the Perl Monks concerning the following question:

DBI not installed on sever.

All I need in order to get DBI working on the server is the DBI.pm module.....I am going to download it and install it manually.....I just want to be sure that this is all I need.

my script would look somhting like this:

#!/usr/bin/perl use lib 'home/public_html/'; use DBI; use CGI; $q = new CGI; ...................................................
Doesn't work.....

This doesn't work either:

#!/usr/bin/perl use lib 'C:\Accounts\mysite\wwwRoot'; use DBI; use DBD::Mysql; use CGI; ...............etc.
Still does not work.

The webhost doesn't have it installed, so I'm forced to incorporate it with my normal files......Can someone please help me do this so it works?? I keep getting errors like this:

"Can't locate object method "connect" via package "DBI" (perhaps you f +orgot to load "DBI"?)"

Replies are listed 'Best First'.
Re: Manually installing DBI to server
by dave_the_m (Monsignor) on Feb 04, 2005 at 00:57 UTC
    You can't just copy DBI.pm. The database modules (DBI and the particular DBD:: backend needed for the database in question) include compiled C code, so shared libaries and all sorts of stuff would need to be copied across (and only from a machine with identical hardare and build options).

    You're far better off installing it from source.

    Dave.

Re: Manually installing DBI to server
by jZed (Prior) on Feb 04, 2005 at 04:25 UTC
    You can't just copy DBI.pm. The best thing is to install DBI using apt-get or rpm or ppm or whatever package manager is available for your platform or with CPAN.pm or with a manual make install method. If you get stuck with using one of those, ask in the CB or post another question.

    Even once it gets installed, you're going to have to make sure that your use lib directory is pointing to the right place, it should be an absolute path to your directoy, not a URL.

    If you absolutely can not get it installed, there is a way to cheat and use a pure perl version of DBI and a pure perl version of the MySQL driver. You'd have to copy the entire lib directory from the DBI distribution, put $ENV{DBI_PUREPERL}=1; at the top of your script (before your use DBI statement) and then use the DBD::mysqlPP. driver. I do not recommend this, you're much better off installing the full DBI.

Re: Manually installing DBI to server
by Thilosophy (Curate) on Feb 04, 2005 at 05:30 UTC