I worte some cgi scripts with Perl on my home PC: Win2k Professional, Perl 5.8.6 and MySQL 4.1.13. When I uploaded these to my website, they didn't work. Here's one script, dumbed doen to the point where its just a "Hello World" type of thing with some cgi afterwards:

#!/usr/bin/perl use strict; use DBI; use CGI qw(:standard); use CGI::Carp "fatalsToBrowser"; my $dbh = DBI->connect("dbi:mysql:database=dbname;host=localhost", "uname", "pword") or die "Unable to connect to DB: $DBI::errstr"; $dbh->disconnect(); print header, start_html(-title=>'Title', -BGCOLOR=>'blue', -text=>'white'), p('test'), end_html;

My web hosting service uses Perl 5.8.4 and MySQL 5.0.18.

Running this script via Firefox yields a blank white page; clicking "View Source" bring up a completely blank window. In IE, I get a "Cannot find server/this page cannot be displayed" error. Nothing shows up in the error log. If I remove the "dbh->connect" line, the page functions properly.

Even if I've mucked up the connection string somehow, shouldn't any error be posted to the browser via fatalsToBrowser? I am getting no feedback on what might be going wrong, and I am stumped.

Help!

Kevin


In reply to dbh connections: stumped! by kevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.