1、如何在系统下有效防范 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 (懒人 U 盘启动 http:/ 以外的文件将不会被允许,如果错误显示打开的话会提示这样的错误:Warning: open_basedir restri
2、ction 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 处理文件的函数主要
3、有:fopen,mkdir,rmdir,chmod,unlink,dirfopen,fread,fclose ,fwrite,file_existsclosedir,is_dir,readdir.opendirfileperms.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,f
4、ileperms.copy,unlink,delfileok,大功告成,php 木马拿我们没辙了,遗憾的是这样的话,利用文本数据库的那些东西就都不能用了。如果是在 windos 平台下搭建的 apache 我们还需要注意一点,apache 默认运行是 system 权限,这很恐怖,这让人感觉很不爽。那我们就给 apache 降降权限吧。net user apache -microsoft /addnet localgroup users apache /delok.我们建立了一个不属于任何组的用户 apche。我们打开计算机管理器,选服务,点 apache 服务的属性,我们选择 log on,选择 this account,我们填入上面所建立的账户和密码,重启 apache 服务,ok,apache 运行在低权限下了。实际上我们还可以通过设置各个文件夹的权限,来让apache 用户只能执行我们想让它能干的事情,给每一个目录建立一个单独能读写的用户。这也是当前很多虚拟主机提供商的流行配置方法哦,不过这种方法用于防止这里就显的有点大材小用了。其实对于自己的电脑系统没有进行过有效的安全保护,是很容易招惹病毒木马的侵入。所以大家也应该赶紧针对 PHP 木马进行有效的防范措施吧。本文来自 U 盘网 http:/