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

目录
相关文章
Fatal error: Call to undefined function openssl_pkey_get_private()
Fatal error: Call to undefined function openssl_pkey_get_private()
321 0
|
Java 中间件 Serverless
Serverless 应用引擎操作报错合集之在阿里函数计算中,云函数怎么一直报错Function instance exited unexpectedly(code 1, message:operation not permitted) with start command 'php server.php '.如何解决
Serverless 应用引擎(SAE)是阿里云提供的Serverless PaaS平台,支持Spring Cloud、Dubbo、HSF等主流微服务框架,简化应用的部署、运维和弹性伸缩。在使用SAE过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
475 2
|
PHP
PHP __call() 方法的一种妙用
PHP __call() 方法的一种妙用
288 0
|
JavaScript 前端开发
报错:Cannot read properties of undefined (reading ‘$message‘)解决方法
以上就是解决"Cannot read properties of undefined (reading ‘$message‘)"错误的几种方法,希望对你有所帮助。
7771 0
|
JSON 数据格式
setInterval函数的function与()=>区别——解决Cannot readproperty‘XXXXXXX‘of undefined异常
setInterval函数的function与()=>区别——解决Cannot readproperty‘XXXXXXX‘of undefined异常
295 0
|
监控 Linux Apache
访问zabbix安装页面报错500,apache报错Call to undefined function mb_detect_encoding()
访问zabbix安装页面报错500,apache报错Call to undefined function mb_detect_encoding()
650 0
|
PHP
PHP报错Call to undefined function utf8_decode()的解决方案
PHP报错Call to undefined function utf8_decode()的解决方案
384 0
|
JavaScript
Cannot read properties of undefined (reading ‘push‘)“ 报错 解决方法
一.首先这个报错的大致意思就是不能读取这个push方法,顾名思义就是使用这个方法的变量不是一个数组
3356 0
|
PHP
php模版引擎smarty出现Undefined index的解决方案
php模版引擎smarty出现Undefined index的解决方案
308 0
thinkphp报错Call to undefined method app\index\controller\Index::fetch()
thinkphp报错Call to undefined method app\index\controller\Index::fetch()
559 0

热门文章

最新文章