Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've written a game using PHP web sockets that runs well on my local development server. I'm now attempting to run the web socket server on a non-local server, but my client JavaScript isn't able to connect. I'm attempting this on a clean install of Ubuntu Server x64 - I've installed apache2, php5, and made sure the PHP socket extention is enabled; the server is working great for non-web socket purposes.

Is there a configuration setting I'm missing? I've tried shutting down my firewall (via ufw disable). Any clues would be much appreciated.


Here's the PHP library I'm using:

I've realized that I actually won't be needing apache for what I'm doing - I only need the incoming requests to be accepted and interpreted by PHP. Is there a way to ensure that all incoming requests are accessible to my PHP program?

share|improve this question
up vote 1 down vote accepted

Are you using apache module for websockets? There are quite a few PHP websocket servers implemented that you can try. Here are a few, , , . There are a couple more if you look around. If youp provide more details on your environment and implementation, help is easier.


Change line 62 from in to

$Server->wsStartServer('', 9300);

or the IP to your external LAN IP and it should work. Restart the server.php after the change.

share|improve this answer
Thanks for response - see my edit. – Nathan Friend Aug 18 '12 at 3:37
Is this basic test working? -- – Chida Aug 18 '12 at 4:17
Just tried it out - yes, it is working, as long as I'm accessing it from the server (my client is connecting to Now I just need to figure out how to allow PHP access to the incoming requests... – Nathan Friend Aug 19 '12 at 19:46
Chida, you are my hero. – Nathan Friend Aug 19 '12 at 20:11

As near as I can tell, the Apache packages provided by Ubuntu don't support websockets, and there is no package in Precise Pangolin that contains which is the Apache module that provides support for websockets. You'll need to install the module by hand, or change your production environment to use the same webserver as you're using in development.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.