The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Perl Issue with API adddb call

Discussion in 'cPanel Developers' started by redbeck, Feb 15, 2011.

  1. redbeck

    redbeck Member

    Joined:
    Nov 19, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I have discovered that after running perfectly, my install script to create a new MYSQL database is no longer working.

    After some digging in the error_log file, I have noticed that the @INC perl include paths dont relate to the actual server install of Perl. When i check the perl @INC paths, I get the correct version and paths, however the Cpanel API calls are seeing old or wrong Perl paths. Im completely stuck on this one! I've run all the usual upcp --force, updated perl symlinks, checked perl scripts, re-installed DBI.pm etc. All with no result.

    The resulting error is:-


    [2011-02-15 17:29:42 +0000] warn [cpanel] Cpanel::AdminBin::adminrun(mysql) set error in context mysql
    [2011-02-15 17:29:42 +0000] warn [cpanel] Cpanel::AdminBin::adminrun(mysql) set error in context mysql
    [2011-02-15 17:29:42 +0000] warn [mysql::adddb] Encountered error in mysql::adddb: The MySQL?? server is currently offline.
    [2011-02-15 17:29:43 +0000] die [Internal Death while parsing 58262] Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpanel /usr/local/cpanel/perl /usr/local/cpanel/perl/5.6.2/i386-freebsd /usr/local/cpanel/perl/5.6.2 /usr/local/cpanel/perl/site_perl/5.6.2/i386-freebsd /usr/local/cpanel/perl/site_perl/5.6.2 .... etc etc

    DBI is installed, and everything Perl wise looks ok. When I run print @INC at the command line, I get the following:-

    perl -e "print @INC;" gives me:-

    /usr/local/lib/perl5/5.10.1/BSDPAN/usr/local/lib/perl5/site_perl/5.10.1/mach/usr/local/lib/perl5/site_perl/5.10.1/usr/local/lib/perl5/5.10.1/mach/usr/local/lib/perl5/5.10.1

    Any clues? Much appreciated. :confused:
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi redbeck,

    I think the DBI @INC is a red herring. Because the MySQL protocol is (has been? [Oracle]) part of what the MySQL/Sun group has considered part of their property covered by the GPL license that MySQL Community ships under, we cannot compile DBI into our binaries, which includes the mysqladmin wrap binary (which performs or delegates MySQL actions in the necessary privileged state). We attempt to include DBI and use that, and if that fails (will produce errors just like yours) we fallback to using various functions that interact with the MySQL client.

    I'm more curious about AdminBin errors.

    What version of cPanel are you running. What day did you notice the script not functioning. Any chance we can see you script, and test it in our lab? Is this affecting one server or multiple? Is your MySQL server remote or local to the cPanel server?

    If I don't see something doesn't immediately surface, I might ask you to open a support ticket and so we can get some more eyes on the issue.

    Best Regards,
    -DavidN
     
  3. redbeck

    redbeck Member

    Joined:
    Nov 19, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi David

    Thanks for your reply. The script I'm running uses your offical Cpanel PHP library (xmlapi.class.php) please see below. I only noticed it wasnt working yesterday, however we last used it around mid Decemeber as we are still working on the account package that uses it. It was all working well until we tried again yesterday.

    I did try to symlink the required modules (DBI.pm, DBI.so etc) for trial and error puposes, but ended up with:-

    DBI: /usr/local/cpanel/perl/DBI.so: Undefined symbol "PL_memory_wrap" at /usr/local/cpanel/perl/DynaLoader.pm line 200.

    We are connecting to a local database on the same server and its currently only effecting the one server as far as we know. All account creation API calls seem to work, its just the API database calls that are failing ie:-

    The function that we call from your PHP library:-

    public function mysqlAddDb($username, $dbname) {

    $args = array();

    if (!isset($username)) {
    error_log("adddb requires that user is passed to it");
    return false;
    }
    return $this->api1_query($username, 'Mysql', 'adddb', array($dbname));
    }

    Our Cpanel version is:-

    WHM 11.28.83
    FREEBSD 7.2 i386 standard on server3.

    Many thanks for your help!


    ---------------------------------------------
    FULL output of errors below:-
    ---------------------------------------------

    [2011-02-16 13:43:28 +0000] warn [cpanel] Cpanel::AdminBin::adminrun(mysql) set error in context mysql
    [2011-02-16 13:43:29 +0000] warn [cpanel] Cpanel::AdminBin::adminrun(mysql) set error in context mysql
    [2011-02-16 13:43:29 +0000] warn [mysql::adddb] Encountered error in mysql::adddb: The MySQL?? server is currently offline.
    [2011-02-16 13:43:29 +0000] die [Internal Death while parsing 5124] Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpa$
    Cpanel::Mysql::BEGIN() called at DBI.pm line 8
    eval {...} called at DBI.pm line 8
    require Cpanel/Mysql.pm called at (eval 5) line 1
    eval ' require Cpanel::Mysql; Cpanel::Mysql::Mysql_init();
    ;' called at /usr/local/cpanel/Cpanel/LoadModule.pm line 19
    Cpanel::LoadModule::_modloader('Mysql') called at /usr/local/cpanel/Cpanel/LoadModule.pm line 23
    Cpanel::LoadModule::loadmodule('Mysql') called at cpanel line 1040
    main::api1_get_handler('Mysql', 'adduser') called at cpanel line 794
    main::docpanelaction('HASH(0x9072f04)') called at cpanel line 5046
    main::run_fast_xml_mode() called at cpanel line 413


    [2011-02-16 13:43:29 +0000] warn [cpanel] Cpanel::AdminBin::adminrun(mysql) set error in context mysql
    [2011-02-16 13:43:29 +0000] info [cpanel] The mysql server is offline.
    [2011-02-16 13:43:29 +0000] warn [mysql::adduser] Encountered error in mysql::adduser: The mysql server is offline.
    [2011-02-16 13:43:29 +0000] die [Internal Death while parsing 5129] Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpa$
    Cpanel::Mysql::BEGIN() called at DBI.pm line 8
    eval {...} called at DBI.pm line 8
    require Cpanel/Mysql.pm called at (eval 5) line 1
    eval ' require Cpanel::Mysql; Cpanel::Mysql::Mysql_init();
    ;' called at /usr/local/cpanel/Cpanel/LoadModule.pm line 19
    Cpanel::LoadModule::_modloader('Mysql') called at /usr/local/cpanel/Cpanel/LoadModule.pm line 23
    Cpanel::LoadModule::loadmodule('Mysql') called at cpanel line 1040
    main::api1_get_handler('Mysql', 'adduserdb') called at cpanel line 794
    main::docpanelaction('HASH(0x9072f28)') called at cpanel line 5046
    main::run_fast_xml_mode() called at cpanel line 413


    [2011-02-16 13:43:30 +0000] die [Internal Death while parsing 5134] Can't locate DBI.pm in @INC (@INC contains: /usr/local/cpa$
    Cpanel::Mysql::BEGIN() called at DBI.pm line 8
    eval {...} called at DBI.pm line 8
    require Cpanel/Mysql.pm called at (eval 5) line 1
    eval ' require Cpanel::Mysql; Cpanel::Mysql::Mysql_init();
    ;' called at /usr/local/cpanel/Cpanel/LoadModule.pm line 19
    Cpanel::LoadModule::_modloader('Mysql') called at /usr/local/cpanel/Cpanel/LoadModule.pm line 23
    Cpanel::LoadModule::loadmodule('Mysql') called at cpanel line 1040
    main::api1_get_handler('Mysql', 'addhost') called at cpanel line 794
    main::docpanelaction('HASH(0x9072eec)') called at cpanel line 5046
    main::run_fast_xml_mode() called at cpanel line 413
     
  4. redbeck

    redbeck Member

    Joined:
    Nov 19, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Figured it out! MySQL was disabled on the feature list we were using, therefore disabling the MySql functions needed to create a database.

    I assumed that disabling it would only knock it off the Users cpanel control panel, not disable it entirely for that user, as our Packages allows the creation of one MySql database which we create silently with our scripts.
     
Loading...

Share This Page