centos禁用exec_Centos PHP执行exec()等linux命令错误的解决办法

一、检查您的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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值