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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:12:39
Original
1485 people have browsed it

一、检查您的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");?>
Copy after login

比如 我的运行用户组是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=
Copy after login

done! 现在您应该可以在php跑linux命令了!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template