Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Hit the MySQL with PERL

Discussion in 'General Discussion' started by ehsan, Jul 10, 2002.

  1. ehsan

    ehsan Well-Known Member

    Joined:
    Dec 11, 2001
    Messages:
    185
    Likes Received:
    0
    Trophy Points:
    316
    Hi,
    How do i hit database with PERL, are the modules installed by default for that or not?
    I have something like

    #!/usr/local/bin/perl
    print &Content-type: text/html\n\n&;
    print &1&;

    use CGI;
    use DBI;

    my $db = &DBI:mysql:dbname&;
    my $username = &dbuser&;
    my $pass = &dbpass&;
    my $dbh = DBI-&connect($db, $username, $pass)
    or die &Unable to connect to the Database: $dbh-&errstr\n&;
    print &2&;
    ....


    --------------
    after I run the script, it prints 1 but it does not print 2, seems like it dies somewhere ...


    Thanks,

    ~ dude
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    San Clemente, Ca
    well if you run the perl script and you dont get a @INC error then you have all the required modules installed.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Site5-Matt

    Site5-Matt Well-Known Member
    PartnerNOC

    Joined:
    Aug 10, 2001
    Messages:
    81
    Likes Received:
    0
    Trophy Points:
    306
    [quote:78d2a4c64b][i:78d2a4c64b]Originally posted by ehsan[/i:78d2a4c64b]
    ...
    or die &Unable to connect to the Database: $dbh-&errstr\n&;
    ...[/quote:78d2a4c64b]I would recommend changing $dbh-&errstr to $DBI::errstr

    Also, just to make sure, run the following command on your server:

    perl -MCPAN -e 'force install DBD::mysql'
     
  4. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    San Clemente, Ca
    /scripts/installdbi
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice