一、检查您的php用的是哪个用户组:
可以查看nginx配置文件或者apache配置文件
如:/etc/nginx/nginx.conf 或: /etc/httpd/conf/httpd.conf
也可以用:
exec(‘whoami’,$array,$status)
二、
vim /etc/sudoer
1.加上www(假设你的用户名是www)用户 www ALL=(ALL) NOPASSWD:ALL
2. vim 下 / 查找LS_COLORS 将它去掉(Ubuntu没有这个的可以省略)
然后注释掉
Defaults requiretty
Defaults env_reset
这两句!
三、
vim /etc/php.ini
检查:
safe_mode = (这个如果为off下面两个就不用管了)
disable_functions =
safe_mode_exec_dir=
done! 现在您应该可以在php跑linux 命令了!
记住一定要重启php-fmp 和nginx
/etc/init.d/php-fpm restart
/etc/init.d/nginx restart