Websocket with PHP using IIS 8.0 server

Asked

Viewed 384 times

1

Good morning.

Next, I downloaded the following project as an example to create a Websocket:

http://www.nhatanh.net/blog/websocket-php-html5-tutorial-echo-server.html

Testing on a machine with Linux operating system and Apache server worked correctly on the part that was performed to boot the server with the command php server.php, correctly showing in Terminal the connections made and the socket with the chat worked correctly except that the connection was soon lost after a few messages.

However, when testing on a Windows 8 machine and IIS server, when running the command php server.php was not available for the user to verify which requests to the socket were being performed and the socket did not work when connecting, always returns unknown error even with Websocket installed and active in the IIS settings.

How can I make the project with Websocket work properly?

By clicking Connect on the file client.html even after the command to start PHP file:

Websocket Connection to 'Ws://localhost:2207/' failed: Error in Connection establishment: net::ERR_CONNECTION_REFUSED

As it should show in CMD or Terminal:

inserir a descrição da imagem aqui

How it looks in Windows CMD:

inserir a descrição da imagem aqui

1 answer

1


Solved.

In the archive php.ini I’ve cracked the following line:

;extension=php_sockets.dll

And I restarted the IIS server and when running the PHP script it started running.

If you do not have the DLL you can download from the following site:

http://www.php.net/downloads.php

I hope this helps more developers.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.