MySQL Forums
Forum List  »  Perl

Need Help : DBI works with Perl but doesn't works with CGI
Posted by: Deepak Sethi
Date: May 03, 2006 05:57AM

Hi all

i m trying to connect MySQL with Perl 5.8.4 by using DBI, its working perfect on command line but if i m trying to connect with a HTML interface using CGI it shows me Internal Server Error.i 've tried other programs with CGI as such they are working perfect but using CGI with DBI alongwith Perl doesn't worked. Here is my program just to connect with mysql database.

;;;;;;;;;;;;;;;;;;;;;;;CODE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#!c:/phpdev/perl/bin/perl.exe

use strict;
use DBI;
use warnings(FATAL=>'all');
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);

###Datebase Server: mysql ###username: root ### password: subazini

my $dbh = DBI->connect('dbi:mysql:test','root','subazini') || die "Can't connect \n";
print "<html><title>CGI-DBI</title><body><h2>connected </h2><br>";

$dbh->disconnect();
print "<h3>disconnected </h3></body></html>";

;;;;;;;;;;;;;;;;;;;;;;;error;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, dev4@www.firepages.com.au and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

but if try to run the same program on perl's command line it gives me ooutput as :

<html><title>CGI-DBI</title><body><h2>connected
</h2><br><h3>disconnected </h3></body></html>

it 'll be really appreciable if anyone out ther can help me to resolve this problem.

regards

Deepak

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.