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.

cpanel php class not creating object

Discussion in 'cPanel Developers' started by Fusioni, Mar 16, 2016.

  1. Fusioni

    Fusioni Registered

    Joined:
    Mar 16, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    cPanel Access Level:
    Root Administrator
    We used "cPanel API2" library to create park domain in our server and it was working fine until last cPanel up-gradation.

    We created file mytest.live.php on server to create a object of "CPANEL class" for troubleshooting the issue, but unfortunately it returns error as below.

    <?php
    require_once "/usr/local/cpanel/php/cpanel.php";
    $cpanel = new CPANEL(); ?>

    And Output Returns:

    Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146 Stack trace: #0 /home/cityusa/public_html/mytest.live.php(4): CPANEL->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146

    So please help for resolve this issue asap.
     
    #1 Fusioni, Mar 16, 2016
    Last edited by a moderator: Mar 16, 2016
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    It looks like you have opened a support ticket (#7497341) for assistance with your custom application. Could you update us with the outcome once the ticket is closed?

    Thank you.
     
  3. radioative

    radioative Registered

    Joined:
    Mar 28, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    brasil
    cPanel Access Level:
    Reseller Owner
    I have the same issue. Can you help me?

    Regards
    Felipe
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you verify the specific issue you are facing? For instance, what in particular is not working, and what steps have you taken thus far?

    Thank you.
     
  5. radioative

    radioative Registered

    Joined:
    Mar 28, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    brasil
    cPanel Access Level:
    Reseller Owner
    I'm using this script (and nothing else)


    // Instantiate the CPANEL object.
    require_once "/usr/local/cpanel/php/cpanel.php";

    // Connect to cPanel - only do this once.
    $cpanel = new CPANEL();
    // Get domain user data.
    $get_userdata = $cpanel->uapi(
    'DomainInfo', 'domains_data',
    array(
    'format' => 'hash',
    )
    );



    Then, i get this error:


    Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146 Stack trace: #0 /home/mydomain/public_html/xmlapi/Examples/mycode.php(30): CPANEL->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146

     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    The PHP client class is a good place to start:

    GitHub - CpanelInc/xmlapi-php: A PHP Class for Interacting with cPanel's XML-API

    The cPanel API 2 function for parking a domain name is documented at:

    cPanel API 2 Functions - Park::park - Software Development Kit - cPanel Documentation

    You may also find a thread like this one helpful:

    [Resolved] PHP Script creates email account but fails to create forwarder

    It's unrelated to parking a domain name, but offers an example of creating a PHP script with a different API function.

    Thank you.
     
Loading...

Share This Page