Does Chilkat use local ports when communicate with imap via ssh? - php

I use Chilkat component with PHP multithreaded application.
$this->tunnel = new CkSocket();
// Here is connecting to ssh
$this->imap->UseSshTunnel($this->tunnel)
And this is how I use ssh to communicate with imap via ssh.
On the server I also have apache2 running. And the problem is if I open more threads - apache doesn't handle requests. I think maybe Chilkat uses 80 port and then there is conflict ?
But I tried to check busy ports with ubuntu commands and I did not see that chilkat opened ports. Does chilkat do it ? What may be the problem ? Or can I set to chilkat the ports which must not be used ?
This question may touch not only exactly Chilkat component, but sockets generally

For reference, here's the full example: https://www.example-code.com/phpExt/imap_useSshTunnel.asp
In the example, Chilkat is not listening at any port. In other words, Chilkat is not acting as the server-side of any connection. The 1st step in the example above is to establish a connection to an SSH server. The 2nd step is to have the IMAP client (Chilkat) use the existing SSH connection to establish the connection with the IMAP server. Instead of connecting directly (IMAP client to IMAP server) you are establishing the connection through a logical channel on an existing SSH connection. In other words, the IMAP protocol is tunneled through the SSH protocol. In other words, data sent from Chilkat to the IMAP server first travels through the SSH tunnel, then at the SSH server, the data completes its journey to the IMAP server over a regular TLS or non-TLS connection. (If a TLS connection is desired, then the TLS protocol itself is being tunneled through the SSH connection.)

Related

How to setup and run a PHP WebSocket service on a cpanel-based shared hosting platform?

I have created a Chat application in Ratchet PHP. It runs fine on local machine using WAMP. I want it to setup on live server.
On my server I have:
PHP Support
SSH access
Port 9000, which is opened for OutBound connections.
Sub-domains
What I don't have:
No port for InBound connections.
No root access in SSH. Say I cannot see/edit iptables
I ran php server.php which gives success message about the server is started and listening at port 9000. But when a HTML page tries to connect it using ws://domain:9000 it runs into error-
Firefox can’t establish a connection to the server at
ws://domain.com:9000/
I googled a lot and it appears that what I need is a port for inbound connections.
But according to this answer the thing I need is PHP support for Ratchet to work on shared hostings. Can anyone explains what I really need and Is there any workaround If it's not availble in the list of things I have on my server.
Basically, No
It is not likely for a shared hosting environment (i.e. Apache with VirtualHost config, PHP, MySQL, and a CPanel interface) to support your websocket application.
For websocket to work, you need to either:
have a port dedicated to websocket in-bound connections; or
have a HTTP/HTTPS server that knows when to upgrade a connection and proxy pass to your websocket application.
The first route requires the server to allow in-bound connection to a certain port number. This is a potential security issue for the hosting provider and, thus, is unlikely for your vendor to grant you that.
The second route requires Apache server have with both mod_proxy and mod_proxy_wstunnel installed and enabled. It also require you to use ProxyPass config, which cannot be overridden by .htaccess configs at all.
So unless your hosting grants you the permission to touch the Apache main configuration (or would apply such change for you), you're pretty hopeless.
Suggestion
To run your own websocket service, you should think about using Virtual Private Server services such as Amazon EC2, DigitalOcean VPS.

FTP connect in Bluemix PHP

I came to an understanding that FTP connect or any FTP related methods will not work in Bluemix. Is there any twerk or any method that i should include or prefer to make my php application work in Bluemix.
If that is not possible, is there any other service providers like Bluemix that i can use to host my php application ?
for outcoming communication on port: 21 you shouldn't have any issues in Bluemix. It is opened. Instead, all incoming communication on ftp port are blocked. (you can only use http and https port)
Bluemix is a platform as a service (PaaS) based on the Cloud Foundry. It makes no sense to enable the port 21 for incoming traffic. And it should be the same for other platform as a service based on CF.

Host URL of websocketpp server

I've made a websocket server with websocketpp (C++), and a websocket client in PHP. When I test it on my local machine it works: the client can connect to the server and they can send each other some data.
Then I placed the server-script on my server and compiled it there. After compiling it is running and "working": the server is also a client of another server, these connect and transfer data. However, my PHP client cannot connect to the C++ websocket server. I actually do not know which host URL to use. I've tried these:
ws://www.url.nl:port/folder/program-name
ws://www.url.nl:port/
ws://www.url.nl:port/program-name
How can I refer to my server?
I hope my problem is clear, but feel free to ask for clarifications if needed.
Then your url schould be ws://www.url.nl:port/
Make shure there is no firewall on your server/network which blocks your request. You can do this by running telnet www.url.nl port. If you have access to netcat use nc -v www.url.nl port this would give you much more verbose information on your connection status.
It would be very helpfull if you have any error messages. ;-)
EDIT running service:
Make shure your service is running and listen on correct network interface and port.
use netstat -tulpen on linux or netstat -ano on windows
EDIT check your firewall rules:
iptables -L

Do we need a static IP to use HTML5 Websockets?

I am in the process of building a chat application in PHP using Web Sockets. I started with the code phpwebsocket project and here. The code works fine on my local machine but when i try it on my site (does not have a dedicated IP) it has a problem establishing the web socket connection. I tried it with all possible combinations for socket binding (site addres, external ip addr, local ip addr) but failed.
You must be able to connect to the port on the server where the WebSocket server is running. If you are using a port other than 80 or 443 on your site for the WebSocket server, then you probably need to configure (or ask) the site to accept incoming connections on that port (because they may deny it by default for security reasons). It you are unable to telnet to the WebSocket port on the server, then this is likely the case (or phpwebsocket is not in fact correctly configured to list on that port).

php fsockopen unable to connect, connection timeout error

I am running a local apache server on an ubuntu machine, and i am trying to use the phpmailer class to send mail.
It tries to connect by fsockopen to the mail server, but it throws a timeout error. I tried setting the timeout to 15sec with no luck.
It does work on other machines.
How can i find out if my ISP has blocked requests ?
The mail server responds to ping.
ping and SMTP command don't go via the same port ; it is possible that one port is opened, and not the other one.
If there is a timeout, it probably means that :
either your SMTP server is not accepting connections from your server
or there is something somewhere (like a firewall) that's blocking your requests.
If you have an ssh access to the server, using telnet in command line to try to connect to the SMTP server, and send SMTP commands, might allow you to get some more informations...
Here a couple of links that show examples of an SMTP session via telnet :
Sending an e-mail via Telnet
Send mail through SMTP using Telnet
If you cannot connect to the server, maybe you'll get some error message (telling you that you are not allowed to connect, for instance), or it'll timeout again... Which probably means your request are being blocked somewhere...
In that case, check with your network administrator ; maybe he'll have some idea about opening some port on the firewall.

Categories