您的位置:首页 > 编程语言 > PHP开发

root运行php-fpm

2014-05-19 21:22 344 查看
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. 虽然可以这么干,但是还是不建议这么干
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: