Heim >php教程 >php手册 >php system、exec、shell_exec等 函数不能运行命令

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:12:391508Durchsuche

一、检查您的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
也可以用:

<?php echo shell_exec("id -a");?>

比如 我的运行用户组是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命令了!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:cPanel解决无法安装php5.2.7Nächster Artikel:PHP简易渲染模板