需要去除禁用的函数 去php.ini
查询php是哪个用户执行的
ps aux | grep php
需要配置执行php的用户权限
vi /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
www ALL=(ALL) NOPASSWD:ALL
PHP代码
$cmd = "sudo sed -i 's/http:..*:8181/http:\/\/$ip:8181/g' /www/server/panel/vhost/nginx/h.xxx.cn.conf";
system($cmd);
$cmd2 = "sudo nginx -s reload";
system($cmd2);
标签:shell,http,sudo,system,cmd2,nginx,Linux,PHP,php From: https://blog.51cto.com/u_14976802/5932947