php - 如手册中所述,如何在 php 中启用套接字?
问题描述
我已经安装了 Xampp 并且想在 php 中使用套接字,所以我从localhost 上的http://php.net/manual/en/sockets.examples.php的示例代码开始。我得到了这个众所周知的错误:
致命错误:在第 14 行调用 C:\xampp\htdocs\simpletcpipserver.php 中未定义的函数 socket_create()
在网上搜索后,我更改了 PHP.ini 文件:我删除了;
fromextension=php_sockets.dll
并将这部分编辑为:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = C:\xampp\php\ext
php_sockets.dll 存在于该位置。
但我仍然得到同样的错误。
我确实在http://php.net/manual/en/sockets.installation.php上看到了这个:
The socket functions described here are part of an extension to PHP which must be enabled at compile time by giving the --enable-sockets option to configure.
除了我已经做过的,我不明白这意味着什么。
我现在应该让示例代码工作吗?
解决方案
推荐阅读
- python - 使用正则表达式从原始字符串中提取月份名称和日期数字(编辑:来自 7 的新测试用例)
- python - Python数据帧向量范数有效
- c# - 从同步方法调用异步方法
- c# - 如何根据类型强加的谓词集合过滤对象?
- networking - 无法从 docker 容器 ping 主机
- python - 在所有对数对数子图中设置次要刻度
- html - 悬停时的全角引导下拉菜单消失
- c# - Linq 从返回的 var 中获取值
- sql - ActiveRecord 限制从 company_ids 集合返回的用户
- jquery - 我如何在不使用相同代码的情况下简化此代码,范围外的变量不适用于“开始,结束,天”