您好,欢迎访问一九零五行业门户网

php system、exec、shell_exec等 函数不能运行命令

一、检查您的php用的是哪个用户组: 可以查看nginx配置文件或者apache配置文件 如:/etc/nginx/nginx.conf 或: /etc/httpd/conf/httpd.conf 也可以用: ?php echo shell_exec(id -a);? 比如 我的运行用户组是apache,那么, 二、 vim /etc/sudoer 1.加上ww
一、检查您的php用的是哪个用户组:
可以查看nginx配置文件或者apache配置文件
如:/etc/nginx/nginx.conf 或: /etc/httpd/conf/httpd.conf
也可以用:

比如 我的运行用户组是apache,那么,
二、
vim /etc/sudoer
1.加上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 system、exec、shell_exec等 函数不能运行命令, 感谢原作者分享。
其它类似信息

推荐信息