Community discussions

MikroTik App
 
wfuzatto
newbie
Topic Author
Posts: 37
Joined: Wed Dec 28, 2016 3:46 am

GoDaddy's "Connection refused" - PHP API

Wed Feb 07, 2018 4:04 am

Hello,

I'm currently using a remote web server to run PHP API, it run smooth and well.
But when I try to use a Cloud Hosted Linux Web Server on GoDaddy this same API get "Connection refused".

Anyone know anything about any problem with GoDaddy? I've tried with two another Cloud servers and it run's perfectly!


PHP: 5.6
PHP Sockets settings are ON
  public 'socket' => boolean false
  public 'error_no' => int 111
  public 'error_str' => string 'Connection refused' (length=18)

Regards!
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: GoDaddy's "Connection refused" - PHP API

Wed Feb 07, 2018 1:14 pm

You need to allow PHP to make outgoing connections in the OS' firewall.

How exactly do you do that with GoDaddy, I don't know, as it depends on whether PHP is running as (F)CGI or an Apache module, and it also depends on whether SELinux is installed and enabled.

I suggest you contact GoDaddy's support staff, and ask them to allow PHP to make outgoing connections to TCP port 8278.
 
wfuzatto
newbie
Topic Author
Posts: 37
Joined: Wed Dec 28, 2016 3:46 am

Re: GoDaddy's "Connection refused" - PHP API

Wed Feb 21, 2018 6:21 am

Hello boen_robot,

Thanks for your reply.
I've tried to contact goDaddys support and the answer is literally:
Mikrotik API may be the problem. https://www.godaddy.com/community/cPane ... td-p/95333
All settings for PHP are on, no special configurations on Apache....

@Normis give me some helppp
I give you access to my GD account to troubleshoot this.. =(
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: GoDaddy's "Connection refused" - PHP API  [SOLVED]

Wed Feb 21, 2018 12:11 pm

That's not what the reply says, and you're not asking the question that will get you results.

Again: Ask them to "allow PHP to make outgoing connections to TCP port 8728". If you have that, you're set.

OR configure the API to use TCP port 80 (and move Webfig to a different port, or disable it), and connect over that port. f.e.
/ip service set www port=8080
/ip service set api port=80
to move webfig to port 8080, and the API to port 80.

Let me parse the reply you got...
It seems likely that the configuration of your local server is different from that of the cPanel account you're using.
Correct. And the difference is in the firewall configuration.
It's difficult to say exactly what part of the configuration is causing the error.
...because you haven't specified what IP, protocol and port you're connecting to.
Shared hosting plans have increased security and some features are not available.
And as such, you may not have the right to enable outgoing connections to TCP port 8728 yourself... But GoDaddy staff may be able to do so for you.
However, I was able to upload a test websocket script to a test cPanel account and found it was able to connect.
My test script used TCP port 80, a.k.a. HTTP. You can make outgoing connections to THAT port...
My suggestion would be to provide the full script you're using.
... but you're not using TCP port 80, are you?
Someone else in the community might be able to offer suggestions on what's causing the problem if they can review your script.
I don't know what TCP port the MikroTik API uses and/or other specific requirements that it may have, and I don't have the time to research it myself, nor do I have the full environment to reproduce your problem.
 
wfuzatto
newbie
Topic Author
Posts: 37
Joined: Wed Dec 28, 2016 3:46 am

Re: GoDaddy's "Connection refused" - PHP API

Thu Feb 22, 2018 9:11 am

boen_robot, You got it!

I've tested on port 80 and it works! I was using port 58728...
Now I'll contact GD's support to open a private port!

Thank you!
Regards,

Who is online

Users browsing this forum: Ahrefs [Bot], AimiSayo and 83 guests