本文介绍了phpwebsocket-未定义函数socket_create()-在Windows/WAMP上启用php_sockets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从这里签出了PhpWebSockets项目:

I checked out the PhpWebSockets project from here:

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

它位于WAMP服务器内部的本地主机(Windows 7 64位)框中的自己的项目中.我在Windows命令行中发出以下命令来运行server.php文件:

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

我的WAMP实例确实启用了php_sockets扩展名(因为我看到了这个有问题的类似问题).

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?

推荐答案

在另一个线程中找到了答案:

Found the answer in another thread:

PHP Websocket和Wamp Server错误

结果表明,在命令行上运行该文件意味着该文件与WAMP服务器使用的php.ini文件不同.看起来很愚蠢,但事实证明该php.ini文件中并没有注释php_sockets,删除它就消除了该错误.

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.

这篇关于phpwebsocket-未定义函数socket_create()-在Windows/WAMP上启用php_sockets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 14:20