Author Topic: How can i open 2 ports for php sockets?  (Read 6602 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How can i open 2 ports for php sockets?
« on: December 09, 2019, 05:58:05 PM »
Hello, i need to open 2 ports for ws:// connection like 4001 and 4002 for php sockets to one script.
Can you explain me how can i open that 2 ports for running sockets?
I have VPS and use apache only on centos webpanel.
Thank you.

Code: [Select]
// Real-time Dashboard WebSocket server. (Sample URL: website.com:4001/dashboard)
define('DASHBOARD_PROTOCOL', 'ws'); // ws for insecure connection and wss for a secured connection.
define('DASHBOARD_KEY_PATH', 'config/server.pem'); // Path to the PEM file when your using a secured connection.
define('DASHBOARD_HOST', SITE_DOMAIN.SITE_TLD); // Server host.
define('DASHBOARD_PORT', ''); // Server port.
define('DASHBOARD_APP', '/dashboard'); // Application name.
define('DASHBOARD_MAX_CLIENTS', 1000); // Maximal amount of connected clients.
define('DASHBOARD_MAX_CONNECTIONS_IP', 5); // Maximal amount of connections per minute.
define('DASHBOARD_MAX_REQUEST_PM', 300);

Offline
*
Re: How can i open 2 ports for php sockets?
« Reply #1 on: December 09, 2019, 08:04:47 PM »
Go to Security > Firewall Manager > Configuration > Main Configuration.

It will open file editor, then scroll down to
# Allow incoming TCP ports
and
# Allow outgoing TCP ports

Add ports you need to open, click save changes and restart firewall.

Offline
*
Re: How can i open 2 ports for php sockets?
« Reply #2 on: December 09, 2019, 08:09:09 PM »
Go to Security > Firewall Manager > Configuration > Main Configuration.

It will open file editor, then scroll down to
# Allow incoming TCP ports
and
# Allow outgoing TCP ports

Add ports you need to open, click save changes and restart firewall.

Do I need to do anything special to make the script work with ws:// or is it just what it described?

The script description just says to open 2 sockets, nothing more and I don't know how to do it.

Offline
*
Re: How can i open 2 ports for php sockets?
« Reply #3 on: December 09, 2019, 08:17:22 PM »
I think you only need to open ports, you need to check the script documentation.

Offline
*
Re: How can i open 2 ports for php sockets?
« Reply #4 on: December 09, 2019, 08:33:59 PM »
I think you only need to open ports, you need to check the script documentation.

When i add ports, i have error with enabled firewall.

Status: You have an unresolved error when starting csf:
Error: FASTSTART: (TCP_OUT IPv4) [ -A OUTPUT ! -o lo -p tcp -m conntrack --ctstate NEW --dport 4002 -j ACCEPT] [iptables-restore v1.4.21: invalid port/service `24434001' specified]. Try restarting csf with FASTSTART disabled, at line 5527 in /usr/sbin/csf

You need to restart csf successfully to remove this warning, or delete /etc/csf/csf.error

Offline
*****
Re: How can i open 2 ports for php sockets?
« Reply #5 on: December 24, 2019, 02:54:53 PM »
The port 24434001 cannot be exist. I guess you have forgot the comma 2443,4001
You can ask me to solve any problem with your server for some money in pm  ;)
Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor
Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp

Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services