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!

SOLVED Problem with App that uses UAPI and API 2 - works on localhost not on live remote server

Discussion in 'cPanel Developers' started by ipublicis, Apr 14, 2019.

  1. ipublicis

    ipublicis Member

    Joined:
    Apr 27, 2018
    Messages:
    10
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Lisboa, Portugal
    cPanel Access Level:
    Root Administrator
    We have an application (APP) hosted at SERVER A that is used to manage in a easy way the creation / editing / removal of e-mail addresses (emails are hosted at SERVER A) and the creation of sites and subsites and databases, hosted in SERVER B.

    The APP uses the cPanel API2 and UAPI.

    When running from SERVER A:

    - does not give any error in the management of email addresses (same server as the APP)
    - always gives the same error in creating web hosting "Trying to get property 'cpanelresult' of non-object"
    - the value returned is from our call to the class function a is saved in the var $cpanelresult and is null and not an array as expected (APP is at SERVER A and websites are hosted at SERVER B)

    The APP works fine when used from localhost on any local pc. The error only occurs when it is being run from live at SERVER A and trying to call UAPI or API 2 on SERVER B.

    We looked at the cPanel forum but the only thing we found was the hypothesis of having to do with the PHP version that was different. We changed and now both servers use as base version PHP 7.2 and both via suPHP. The error remains.

    SERVER B's User, Password and Token used in APP in SERVER A (or in localhost) is the same.

    The class we are using to wrap cPanel's API is github.com/N1ghteyes/cpanel-UAPI-php-class

    The code that makes the API call used by the class is:

    57010172_1397346360390503_3925775235835494400_n.png

    Could anyone give us any idea of what might be happening?

    Best regards,

    Lopo
     
    #1 ipublicis, Apr 14, 2019
    Last edited by a moderator: Apr 14, 2019
  2. ipublicis

    ipublicis Member

    Joined:
    Apr 27, 2018
    Messages:
    10
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Lisboa, Portugal
    cPanel Access Level:
    Root Administrator
    Timothy Gramling II, from cPanel was a great help on this.

    The problem was that SERVER B (where the APP runs for) was blocking all TCP Outbound to port 2083.
    The solution was really easy.
    1. Go to your WHM
    2. Select menu "ConfigServer Security & Firewall"
    3. Select the "CFS" pane
    4. On section "csf - ConfigServer Firewall" click on "Firewall Configuration"
    5. Search for "TCP_OUT" and add 2083 to the list
    6. Save it
    7. Reboot CSF (it will ask you to do so)
    8. Done :)
     
    #2 ipublicis, Apr 16, 2019
    Last edited by a moderator: Apr 16, 2019
    cPanelMichael likes this.
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @ipublicis,

    I'm happy to see the issue was solved. Thanks for sharing the outcome!
     
    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