You will get errors like these if your script does not print out a header
before spitting out other information. It is usually best to print the
header in the very beginning of the script so you do not have to worry about
it. You dont have to wait until you are about to print out some html.

$output->header();

Also, if your script has parse errors or something similar you will get that
error.

Hope this helps.

ryan



> Hi,gurus,
> I am a novice at MySQL. When I try to run a sample program in the book of
> "MySQL & mSQL" I get a error message from my apache server as follows,
> *********
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
unable to complete your request.
>
> Please contact the server administrator, [EMAIL PROTECTED] 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.
> *********
>
> The sample program is
>
> #!/usr/bin/perl -w
>
> use strict;
> use CGI qw(:standard);
> use CGI::Carp;
> use DBI;
> CGI::use_named_parameters(1);
>
> my ($db);
> my $output = new CGI;
>
> $db = param('test') or die("Could not find database!");
> my $dbh = DBI->connect("DBI:mysql:$db:$server",root,passward );
>
> if (not $dbh) {
>         print header, start_html('title'=>"Information on $host => $db",
>         'BGCOLOR'=>'white');
>
>         print <<END_OF_HTML;
> <H1>$host</h1>
> <H2>$db</h2>
> For the following reasons the connection failed.<BR>
> $DBI::errstr
> </body></html>
> END_OF_HTML
>         exit(0);
> }
>
> print header, start_html('title'=>"Information on $host => $db",
>         'BGCOLOR'=>'white');
> print <<END_OF_HTML;
> <H1>$host</h1>
> <H2>$db</h2>
> <p>
> Tables<br>
> <UL>
> END_OF_HTML
>
> my @tables = $dbh->func( '_ListTables' );
> foreach (@tables) {
>          print "<LI>$_\n";
> }
> print <<END_OF_HTML;
> </ul>
> </body></html>
> END_OF_HTML
>        exit(0);
> ********************
>
> Could someone tell me what is wrong? Thanks a lot.
>
> Regards,
>
> --Wen
> [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to