phpwebsocket - Undefined Function socket_create() - Have php_sockets enabled on Windows/WAMP

Bing picture Bing · Feb 4, 2014 · Viewed 8.3k times · Source

I checked out the PhpWebSockets project from here:

https://code.google.com/p/phpwebsocket/

It's in its own project on my localhost (Windows 7 64-bit) box, inside of a WAMP server. I issue the following command in Windows Command Line to run the server.php file:

C:\wamp\bin\php\php5.4.12\php.exe C:\wamp\www\phpwebsocket\server.php

But it results in the following error message:

PHP Fatal error: Call to undefined function socket_create() in C:\wamp\www\phpwebsocket\server.php on line 58

My WAMP instance DOES have the php_sockets extension enabled (since I saw this similar question who had that problem).

Anyone know what I could possibly be doing wrong?

Answer

Bing picture Bing · Feb 4, 2014

Found the answer in another thread:

Error with PHP Websocket and Wamp Server

Turns out running the file on the command line means it uses a different php.ini file than the WAMP server does. Seems stupid, but turned out php_sockets wasn't uncommented in that php.ini file, and removing it removed the error with it.