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

ipublicis

Member
Apr 27, 2018
10
2
3
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
 
Last edited by a moderator:

ipublicis

Member
Apr 27, 2018
10
2
3
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 :)
 
Last edited by a moderator:
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Hello @ipublicis,

I'm happy to see the issue was solved. Thanks for sharing the outcome!