windows下 Call to undefined function posix_getpid() in ……\Workerman\Worker.php 的解决方法

简介: windows下 Call to undefined function posix_getpid() in ……\Workerman\Worker.php 的解决方法

windows(win10)下Workerman运行报错: Call to undefined function posix_getpid() in ……\Workerman\Worker.php

问题还原


在windows中调用运行workerman时调用stopAll()时报错

Call to undefined function posix_getpid() in ……\Workerman\Worker.php:1830

问题原因


posix_getpid函数依赖于POSIX扩展,而POSIX扩展不支持在Windowns中使用。

posix_getpid函数用于获取当前php进程pid,所以寻找其在windows下的替代方法。最终找到getmypid方法,这个方法在所有平台通用两者的具体差别暂不考虑。

解决方法


将报错处代码的posix_getpid方法替换为getmypid方法就好了

image.png

目录
相关文章
|
PHP
windows11 vscode 配置 php环境
windows11 vscode 配置 php环境
238 0
|
人工智能 Windows
windows小问题解决方法
windows小问题解决方法
264 0
|
安全 测试技术 Windows
Windows Ancillary Function Driver for WinSock 权限提升漏洞(CVE-2023-21768)
Windows Ancillary Function Driver for WinSock 存在权限提升漏洞
883 1
|
机器学习/深度学习 并行计算 异构计算
WINDOWS安装eiseg遇到的问题和解决方法
通过本文的详细步骤和问题解决方法,希望能帮助你顺利在 Windows 系统上安装和运行 EISeg。
956 2
|
弹性计算 安全 网络安全
阿里云国际版无法远程连接Windows服务器的解决方法
阿里云国际版无法远程连接Windows服务器的解决方法
Windows7电脑启动时提示文件winload.exe无法验证其数字签名,错误代码0xc0000428的解决方法
Windows7电脑启动时提示文件winload.exe无法验证其数字签名,错误代码0xc0000428的解决方法
|
PHP Windows
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
【Azure App Service for Windows】 PHP应用出现500 : The page cannot be displayed because an internal server error has occurred. 错误
379 1
|
PHP 开发工具 git
【Azure 应用服务】在 App Service for Windows 中自定义 PHP 版本的方法
【Azure 应用服务】在 App Service for Windows 中自定义 PHP 版本的方法
335 1
|
Windows
Windows批处理(BAT)文件执行时“一闪而过或闪退”问题及解决方法
Windows批处理(BAT)文件执行时“一闪而过或闪退”问题及解决方法
12292 1
|
PHP
PHP __call() 方法的一种妙用
PHP __call() 方法的一种妙用
272 0