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

情到浓时终转凉″ 提交于 2020-01-05 05:00:37

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/21564100/phpwebsocket-undefined-function-socket-create-have-php-sockets-enabled-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!