致命错误:调用未定义函数socket_create() [英] Fatal error: Call to undefined function socket_create()

查看:313
本文介绍了致命错误:调用未定义函数socket_create()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是这样的:

if( ($this->master=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)) < 0 )

    {
    die("socket_create() failed, reason: ".socket_strerror($this->master));
    }

当我运行与网络套接字建立连接的php文件时,出现错误 致命错误:调用该行中未定义的函数socket_create() if(($ this-> master = socket_create(AF_INET,SOCK_STREAM,SOL_TCP))< 0)

when I run my php file which create connection with web socket, I got error Fatal error: Call to undefined function socket_create() in the line if( ($this->master=socket_create(AF_INET,SOCK_STREAM,SOL_TCP)) < 0 )

因此,我无法连接Web套接字,也无法从套接字获取响应消息,因为运行客户端页面时浏览器中显示的是套接字状态:3(关闭).

Therefore i am not able to connect web socket and also not able to get response message from socket because Socket Status: 3 (Closed) is displaying in my browser when run client page .

您知道缺少什么吗? 预先谢谢你.

Have you got an idea what is missing? Thank you in advance.

推荐答案

您需要安装(或启用) http: //www.php.net/manual/zh/sockets.installation.php

You'll need to install (or enable) the Socket PHP extension: http://www.php.net/manual/en/sockets.installation.php

这篇关于致命错误:调用未定义函数socket_create()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆