Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Jun 2009
    Posts
    15

    Default Getting Error During Adding WHM Plugin

    Hello, I am planning to create my own whm plugin.

    So I got an example plugin from some forums and I uploaded it to

    addon_hello.cgi to /usr/local/cpanel/whostmgr/docroot/cgi

    Now, I can see my plugin in Plugins section of WHM.

    But when I click this addon from whm I recieve the following error:

    Code:
    open3: exec of /usr/local/cpanel/whostmgr/docroot/cgi/addon_hello.cgi failed at cpsrvd-ssl.pl line 5654
    The code of plugin that I have uploaded is following:

    Code:
    #!/usr/bin/perl
    #WHMADDON:helloworld:Hello World <b>Example</b>
    ###############################################################################
    #	This is an example hello world WHM plugin feel free to modify it as you see fit
    ###############################################################################
    # Load general use case perl modules
    use lib '/usr/local/cpanel';
    use Cpanel::cPanelFunctions ();
    use Cpanel::Form            ();
    use Cpanel::Config          ();
    use Whostmgr::HTMLInterface ();
    use Whostmgr::ACLS          ();
    ###############################################################################
    
    print "Content-type: text/html\r\n\r\n";
    
    # Check user has root permissions
    Whostmgr::ACLS::init_acls();
    if ( !Whostmgr::ACLS::hasroot() ) {
    	# User is not root, tell them where to go
    	print "You need to be root to see the hello world example.\n";
    	exit();
    }
    
    # Parse input parameters from GET and POST into $FORM{} for later use
    my %FORM     = Cpanel::Form::parseform();
    
    # Print a WHM Header
    Whostmgr::HTMLInterface::defheader( "Hello World Example Plugin",'/path/to/logo.gif', '/cgi/addon_helloworld.cgi' );
    
    # Print General Output
    print "<p>Hello world indeed...</p>";
    
    # End Example
    
    1;
    Please help in this regard and help me to resolve the error I am recieving.

    Although for me the code of plugin is ok.

    Is that any other configuration needed ?

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Is this .cgi file owned by root:root? If not, please make it so .

  3. #3
    Member
    Join Date
    Jun 2009
    Posts
    15

    Default

    Yes it is owned by root.

    But still i get the error.

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Hmm, maybe your '/path/to/logo.gif' parameter is causing the script to cease functioning?

  5. #5
    Member
    Join Date
    Jun 2009
    Posts
    15

    Default

    I changed it to:

    Code:
    # Print a WHM Header
    Whostmgr::HTMLInterface::defheader( "Hello World Example Plugin",'', '/cgi/addon_helloworld.cgi' );
    But still I am getting the same error.

  6. #6
    Member
    Join Date
    Jun 2009
    Posts
    15

    Default

    Also, I removed the header.

    The same error is comming.

  7. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by madihrb View Post
    Also, I removed the header.

    The same error is comming.
    Hmm, your code with that modification is working on my test server. Did you chmod +x the .cgi script?

  8. #8
    Member
    Join Date
    Jun 2009
    Posts
    15

    Default

    I tried but still the same error I am recieving:

    To test I added only two lines:

    Code:
    #!/usr/bin/perl
    #WHMADDON:bhai:Hello
    Its name is addon_bhai.cgi.

    Its permission is -rwxr-xr-x.

    It is owned by root i.e user=root & group=root.

    It is uploaded to /usr/local/cpanel/whostmgr/docroot/cgi/.

    Code:
    open3: exec of /usr/local/cpanel/whostmgr/docroot/cgi/addon_bhai.cgi failed at cpsrvd-ssl.pl line 5654
    I don't know why it is showig in my system.

  9. #9
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by madihrb View Post
    I tried but still the same error I am recieving:

    To test I added only two lines:

    Code:
    #!/usr/bin/perl
    #WHMADDON:bhai:Hello
    Its name is addon_bhai.cgi.

    Its permission is -rwxr-xr-x.

    It is owned by root i.e user=root & group=root.

    It is uploaded to /usr/local/cpanel/whostmgr/docroot/cgi/.

    Code:
    open3: exec of /usr/local/cpanel/whostmgr/docroot/cgi/addon_bhai.cgi failed at cpsrvd-ssl.pl line 5654
    I don't know why it is showig in my system.
    What happens when you execute this shell script manually from the command line?

Similar Threads & Tags
Similar threads

  1. Replies: 24
    Last Post: 11-23-2010, 07:44 PM
  2. WHM plugin
    By sehh in forum cPanel Developers
    Replies: 3
    Last Post: 12-03-2007, 12:09 PM
  3. Error in adding accounts in whm
    By sharmaine in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-05-2004, 03:11 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube