有没有什么好的php防御木马,有效防御PHP木马攻打的技巧

1、防止跳出web目录

最先修正httpd.conf,假设你只准许你的php脚本顺序在web目录里操作,还能够修正httpd.conf文件限定php的操作途径。比如你的web目录是/usr/local/apache/htdocs,那么在httpd.conf里加上这么几行:

php_admin_value open_basedir /usr/local/apache

/htdocs

这样,假设脚本要读取/usr/local/apache/htdocs以外的文件将不会被准许,假设错误显示翻开的话会提示这样的错误:

Warning: open_basedir restriction in effect. File is in wrong directory in

/usr/local/apache/htdocs/open.php on line 4

等等。

2、防止php木马执行webshell

翻开safe_mode,

在,php.ini中配置

disable_functions= passthru,exec,shell_exec,system

二者选一即可,也可都选

3、防止php木马读写文件目录

在php.ini中的

disable_functions= passthru,exec,shell_exec,system

后面加上php处理文件的函数

首要有

fopen,mkdir,rmdir,chmod,unlink,dir

fopen,fread,fclose,fwrite,file_exists

closedir,is_dir,readdir.opendir

fileperms.copy,unlink,delfile

即成为

disable_functions= passthru,exec,shell_exec,system,fopen,mkdir,rmdir,chmod,unlink,dir

,fopen,fread,fclose,fwrite,file_exists

,closedir,is_dir,readdir.opendir

,fileperms.copy,unlink,delfile

ok,大功告成,php木马拿咱们没辙了,遗憾的是这样的话,运用文本数据库的那些东西就都不能用了。

假设是在windos平台下搭建的apache咱们还须要留意一点,apache默许运转是system权限,这很恐惧,这让人觉得很不爽.那咱们就给apache降降权限吧。

net user apache fuckmicrosoft /add

net localgroup users apache /del

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值