-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V6 chown函数异常 #5437
Comments
检查一下是否有nobody这个用户 |
@NathanFreeman nobody 是一个特殊的id,问题是在5.1.3上是好的, @jingjingxyk 基于6.0构建的这个swoole-cli后就出问题了 |
在你的运行环境中,执行如下shell 命令 确认是否有输出 id -u nobody
swoole-cli v6 swoole v6 最大的区别就是 需要PHP 启用 ZTS (Zend Thread Safe) 环境 |
试试 把 nobody 换成 nobody 对应的uid |
@jingjingxyk 把 nobody 换成 nobody 对应的uid确实不报错了,但是感觉这不是长久之计吧?每台设备都要单独改代码 |
使用 $uid = -1;
$userinfo = posix_getpwnam("nobody");
if ($userinfo !== false) {
var_dump($userinfo);
$uid = $userinfo ['uid'];
} else {
throw new Exception(' no found user nobody ! ');
}
|
不行,PHP代码中调用posix_getpwnam返回值是false,但是控制台执行id -u nobody有值 @jingjingxyk |
@matyhtf 麻烦再开一下呢,问题还没有解决 |
建议 |
Please answer these questions before submitting your issue.
What did you do? If possible, provide a simple script for reproducing the error.
chown($logFile,'nobody');
What did you expect to see?
文件所有者应改为 nobody
What did you see instead?
文件所有者依然是root,并出现以下提示:
Warning: chown(): Unable to find uid for nobody in ......
open(......) failed. Error: Permission denied[13]
What version of Swoole are you using (show your
php --ri swoole
)?swoole V6
What is your machine environment used (show your
uname -a
&php -v
&gcc -v
) ?Linux iZuf68ujmphbn8maxiqqp6Z 5.10.134-12.2.al8.x86_64 编译出错 #1 SMP Thu Oct 27 10:07:15 CST 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: