1. Prevent jumping out of the web directory
First modify the httpd.conf, if you only allow your PHP script to operate in the Web directory, you can also modify the httpd.conf file limit php operation path. For example, if your web directory is/usr/local/apache/htdocs, then add a few lines to the httpd.conf:
Php_admin_value Open_basedir/usr/local/apache
/htdocs
This way, if the script is to read files other than/usr/local/apache/htdocs will not be allowed, if the error display opens, it will prompt such an error:
Warning:open_basedir restriction in effect. File is in wrong directory in
/usr/local/apache/htdocs/open.php on line 4
Wait a minute.
2, prevent PHP trojan execution Webshell
Open Safe_mode,
In PHP.ini, set the
Disable_functi
Choose either one, or you can choose
3, prevent the PHP trojan read and write files directory
In the php.ini
Disable_functi
Add a function of PHP to process the file later
Mainly has
Fopen,mkdir,rmdir,chmod,unlink,dir
Fopen,fread,fclose,fwrite,file_exists
Closedir,is_dir,readdir.opendir
Fileperms.copy,unlink,delfile
That becomes
Disable_functi,fopen,mkdir,rmdir,chmod,unlink,dir
, fopen,fread,fclose,fwrite,file_exists
, Closedir,is_dir,readdir.opendir
, Fileperms.copy,unlink,delfile
OK, it's done, PHP Trojan take us out of the way, unfortunately, the use of the text database of those things can not be used.
If the Apache is built under the WinDOS platform, we also need to note that Apache default operation is the system permissions, which is very scary, it makes people feel very uncomfortable. So let's give Apache permission to drop it.
NET user Apache Fuckmicrosoft/add
net localgroup users Apache/del
Ok. We have created a user apche that does not belong to any group.
We open the Computer Manager, select the service, point to the properties of the Apache service, we choose Log on, select the account, we fill in the accounts and passwords established above, restart the Apache service, Ok,apache run under the low authority.
In fact, we can also set individual folder permissions, so that Apache users can only do what we want it to do, to each directory to create a separate read and write users. This is also a popular configuration method for many current web hosting providers, but this method is used to prevent a bit of overkill here.
The above describes the Photoshop CS5 official Chinese hack version of the download PHP Trojan attack defense skills, including the Photoshop CS5 the official Chinese version of the download of the content, I hope that the PHP tutorial interested friends helpful.