mod_perl && DBI && DBD

mod_perl && DBI && DBD

Post by Mário Gamit » Tue, 02 Jan 2001 00:29:39



Hi!

I've installed apache with mod_perl which i'm preety shure is working fine,
because i use phpinfo() function to test apache's configuration.

At a friend of mine's advice, I've also installed modules DBD and DBI for
MySQL (he claims that it makes life much easier while programming with DBs)

How can i verify if these two modules are peroperly installed?
They are not being reported by phpinfo()

Thanks in advance.

Mrio Gamito
pt is for Portugal

 
 
 

mod_perl && DBI && DBD

Post by Pumpkinhe » Tue, 02 Jan 2001 11:23:04


Here's part of a tutorial that I'm putting together on the subject:

* Verify the DBI/DBD installation *

Here we will run a script that will connect to the database "test"
(which is created during the MySQL install) and perform a simple SQL
query using the Perl DBI.

        a) Write this script and save it as "dbi_connect.pl"

#!/usr/bin/perl -w

# A test script for connecting to a database using the Perl DBI

use DBI;     # Loads the DBI module

my $driver   = "mysql";
my $database = "test";
my $hostname = "localhost";
my $username = "<username>";
my $password = "<password>";
my $when;

my $dsn = "dbi:$driver: database=$database , host=$hostname";

my $dbh = DBI->connect($dsn , $username , $password)
    or die "Can't connect to MySQL database: $DBI::errstr\n";

# issue query
$sth = $dbh->prepare

(
"SELECT now()"
);

$sth->execute ();

# read results of query, then clean up
$when = $sth->fetchrow_array ();
$sth->finish ();
print "$when\n";

$dbh->disconnect or warn "Disconnection failed: $DBI::errstr\n";

exit;  

        b) Edit it by specifying your MySQL username and password

        c) Make it executable and run it.

If you get the current date and time then you're all set!

- Pumpkinhead -

On Sun, 31 Dec 2000 15:29:39 +0000, =?ISO-8859-1?Q?M=E1rio?= Gamito


>Hi!

>I've installed apache with mod_perl which i'm preety shure is working fine,
>because i use phpinfo() function to test apache's configuration.

>At a friend of mine's advice, I've also installed modules DBD and DBI for
>MySQL (he claims that it makes life much easier while programming with DBs)

>How can i verify if these two modules are peroperly installed?
>They are not being reported by phpinfo()

>Thanks in advance.

>Mrio Gamito
>pt is for Portugal


 
 
 

1. PERL && mod_perl && FreeBSD && Apache

k, I don't know where this falls under or who I should be asking... but
here's my problem.

mod_perl port installed Perl modules in
'/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/Apache/' but didn't


have to rebuild the system perl components? the mod_perl? or is there a conf
file somewhere that I cannot find?



could 'mv' everything as well... but I would like to hear some other
opinions or options.

Thanks

2. laptop screen goes black after 1 minute

3. &&&&----Looking for a unix shell------&&&&&

4. DNS setup: world can't see host.mydomain

5. ppp && PPPoE && ADSL && net && buffer(s)

6. Transmit timeout with 3C590

7. &#27809;&#26377;&#20154;&#29992;&#20013;&#25991;&#21527;&#65311;

8. Anyone with Gateway 2000 +32m +Mach64 have Xfree86 running?

9. &&&&&& SUGGESTION ??? &&&&&&&&

10. problems with (Apache && Solaris && mod_perl)

11. Hercules &&&&&& SVGA ?

12. &#1056;&#1091;&#1089;&#1080;&#1092;&#1080;&#1082;&#1072;&#1094;&#1080;&#1103; NetBSD (1.5.1) Locale koi8-r

13. &&&&&& NEEED HELP COMPAQ AND XXXXXXXXXXX