易截截图软件、单文件、免安装、纯绿色、仅160KB

防范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 等等。
如果有多个基于域名的虚拟主机
<VirtualHost *>
ServerName     www.test1.com
DocumentRoot /usr/local/apache/htdocs/test1
<Directory /usr/local/apache/htdocs/test1>
     php_admin_value open_basedir     /usr/local/apache/htdocs/test1
</Directory>
</VirtualHost>
注意:在php_admin_value open_basedir别忘了加上php.ini中指定的PHP临时上传目录和session保存目录,不然会无法上传文件、存取session
php.ini中按如下配置:
upload_tmp_dir = "/tmp"
session.save_path = "/var/phpsession"
  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木马拿我们没辙了.


相关文档:

PHP 正则表达式查找字符串

<?php
set_time_limit(0);
$url='http://item.taobao.com/auction/item_detail.htm?xid=0db2&item_num_id=4512430274&cm_cat=50000671&pm2=1';
$ch = curl_init();
$timeout = 10;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CU ......

php正则取嵌套html标签

<?php
$s = <<<html
<html>
<head>
<title>nested tag test</title>
<mce:script type="text/javascript"><!--
alert('fdsafdasfasd');
// --></mce:script>
</head>
<body>
<div id=0>
<div id=1><img name="im ......

如何将php获得的时间转换为北京时间

从php5.10开始,php中加入了时区的设置,在php中显示的时间都是格林威治标准时间,这就造成了我们中国的用户会差八个小时的问题!
相关设置是修改php.ini中的 date.timezone 参数:
[Date]
; Defines the default timezone used by the date functions
;date.timezone =
默认是关闭的,只需把注释去掉,改为即可
[Dat ......

php while 与do while的区别

本教程来讲一下关于在php编程中常用到的循环语句do while与while的区别吧,while 是当条件为真是才执行而do while至少会执行一下,下面我们就来看看
do {
}while(条件)
看do while的实例吧。
<?
$a =10;
do {
echo $a;
}while ($a>11)
这里会输出10;然后循环终止,那么我们来看看while的实例吧。
$a=10;
w ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号