为什么 php sleep 在 windows-subsystem-linux 中不起作用? [英] Why doesn't php sleep work in the windows-subsystem-linux?
本文介绍了为什么 php sleep 在 windows-subsystem-linux 中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
系统是windows wsl的Ubuntu 20.04.我用apt install php安装php,php版本是7.4.
The system is Ubuntu 20.04 of windows wsl. I install php by apt install php.The version of php is 7.4.
我在 linux shell 中输入 php -r "sleep(2);"
.但它不起作用,立即结束
I type php -r "sleep(2);"
in the linux shell. But it does not work,end immediately
推荐答案
WSL v1 和 Ubuntu 20.04 中存在一个错误.在修复没有出来之前,我的工作是创建自己的睡眠功能,如下所示:
There's a bug into WSL v1 and Ubuntu 20.04. Until the fix doesn't comes out, my work around was creating my own sleep function, as follow:
function waitForSec($sec) {
$arr = [];
$siginf = [];
pcntl_sigtimedwait($arr,$siginf,$sec);
}
干杯!!!!
这篇关于为什么 php sleep 在 windows-subsystem-linux 中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文