php-fpm配置文件php-fpm.conf中指定user root运行php-fpm后启动报错:
ERROR: [pool www] please specify user and group other than root
解决办法s:
1. 运行 php-fpm -h 可以看到
-R, --allow-to-run-as-root
可见,启动时加参数 -R 即可
2. php源码中查找字符串 “ please specify user and group other than root”, 注释掉后面的 return -1;
文件 sapi/fpm/fpm/fpm_unix.c 中,修改如下
if (!fpm_globals.run_as_root) {
if (wp->set_uid == 0 || wp->set_gid == 0) {
zlog(ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name);
/* Allow root run php-fpm
return -1;
*/
}
}
3. 虽然可以这么干,但是还是不建议这么干