0

I would like to start a project that uses websockets for a custom chat. Of course I already have a simple PHP + MySQL Server and I would like to start on top on this. So I found this: https://github.com/Flynsarmy/PHPWebSocket-Chat

To run a websocket server on top of PHP. On my local (Mac) machine, it's running already. But I don't know how to start this script on the server. Because I don't have any Shell access?

This is the server I am using:

http://www.1blu.de/webhosting/homepagepakete/power/

1
  • 2
    I'm not sure that a shared host would even allow you to run sockets. I'd recommend checking with the 1blu support. Commented Feb 21, 2013 at 9:01

2 Answers 2

2

You're going to need shell access. Get in touch with your hosting service and ask if they provide shell access (although it doesn't look like they allow it, or they'd probably say upfront). If not you'll have to find a new service.

Sign up to request clarification or add additional context in comments.

5 Comments

Most hosting companies will offer "dedicated servers", where you can control the whole virtual interface of you server. I think that's what Felix should aim at :)
Even with shell access, his solution is not going to work. The hosting provider is already running an HTTP server; you cannot just implement your own HTTP server from within PHP and disable the one from the hosting provider...
@parasietje That isn't what he wants to do, he wants to use websockets.
Yes, and his demo application "PHPWebsocket-Chat" opens his own Serversocket on port 80. github.com/Flynsarmy/PHPWebSocket-Chat/blob/master/…, line 103
@parasietje It's using port 9300 not 80.
0

WebSocket is a protocol that transforms an initial HTTP-compliant connection into a full-duplex socket using a custom protocol.

There are two ways to do this. Option 1 is to use a standard HTTP-server like Apache to accept the initial HTTP connection. You can then use the Websocket support in this HTTP-server to upgrade to Websocket from the business code. This is what is done in servers like Tomcat or JBoss.

Option 2 is to open your own server socket, essentially creating your own HTTP server from within PHP. You implement a very restricted subset of HTTP yourself, and try to upgrade every connection to WebSocket. This is what the PHPWebsocket library does.

Option 1 is incompatible with PHP. Every webserver uses PHP to generate HTML content. No webserver currently supports upgrading the current HTTP connection to Websocket.

Option 2 is incompatible with hosting providers like GoDaddy or 1Blu. It does not make any sense: you are trying to implement your own webserver, but there is already a webserver running on those machines!

Long story short: as long as no native WebSocket support exists in Apache where control can be forwarded to PHP, you are stuck. See websockets apache server compatibility for different methods of attacking the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.