1、添加用户www到sudoers里面

//修改/etc/sudoers的内容
## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
www   ALL=(ALL)       ALL //新添加这一行
%www        ALL=(ALL)       NOPASSWD: ALL  //设置xxxx组下面的用户使用sudo不需要输入密码

2、修改php.ini中的disable_functions

exec删除

php 执行exec() 操作linux 命令

3、重启服务

service nginx {start|stop|status|restart|reload|configtest}

service php-fpm {start|stop|restart|reload|status}

 4、返回状态

exec($str, $array, $state); //执行命令
var_dump($state);  第三个参数是返回状态   0成功   1失败

 

相关文章: