FTP connect in Bluemix PHP - 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.

Related

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

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.)

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.

How can I access socket through Openshift

I register in the Openshift.com and create a catridge. But when I need to deploy Mosquitto, a MQTT Server, which is accessed through tcp or ssl protocol, and I need visit from public IP.
Does Openshift just redirect http/https protocol through 80/443 port to 8080?
Is it possible to use socket communcation in Openshift?
I have created two applications in Openshift, one for push and the other for web deployment, and I stopped the apache service in order to let the mosquitto service listen to 8080. But only if I send post request in https protocol, It can access to the server for a while and disconnect.
I think this might point you in the right direction https://www.openshift.com/blogs/paas-websockets.
To save some readings from the readers, the steps involved in niharvey's answer:
Create a diy app in your openshift account.
Git checkout the code.
Add a websocket app of your own choice that would bind to $OPENSHIFT_DIY_IP:$OPENSHIFT_DIY_PORT.
Modify the action hooks for starting and stopping your app. Push the code.
From the client, connect to port 8000 for ws:// or 8443 for wss://, by your app url.
Just verified these steps do work as expected.

PHP as a bridge to an smtp/pop3 server

Is it possible if I want to use PHP script to be used as the bridge or the middle man from the clients to the real smtp/pop3 server? The real server is behind a firewall and will not be configured to be accessible for the public. So I need a fake server which just relay the email to the real smtp server. Is it possible to be done?
I'm fairly sure it is fundamentally impossible to have a PHP script on shared hosting perform the functions of a true POP3 / SMTP proxy.
The requests coming from the clients would be using those protocols, and try to connect to your Godaddy server. That server will either have its own POP3 / SMTP server listening on those ports, or none.
You would have to use a server on which you have full root privileges to do this - but then, you will no longer need PHP, there will be better tools to do that available to you there.
Theoretically you could write a proxy, you'd have to implement the wire-level SMTP / POP3 / IMAP protocols in PHP. This would have to be run a a service (i.e. CLI, not inside Apache). If you need a mail proxy, have you considered nginx?

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).

Categories