1. Prevent jumping out of the web directory
First modify httpd.conf. If you only allow your php script program to operate in the web directory, you can also modify the httpd.conf file to limit the operation path of php. For example, if your web directory is /usr/local/apache/htdocs, then add these lines to httpd.conf:
php_admin_value open_basedir /usr/local/apache
/htdocs
In this way, if the script wants to read /usr/local Files other than /apache/htdocs will not be allowed. If the error message is displayed, an error like this will be prompted:
Warning: open_basedir restriction in effect. File is in wrong directory in
/usr/local/apache/htdocs/open. php on line 4
etc.
2. To prevent php Trojans from executing webshell
Open safe_mode,
Set
disable_functi in php.ini
Choose one or both
3. Prevent php Trojans from reading and writing file directories
In php.ini The
disable_functi
is followed by php file processing functions
mainly include
fopen, mkdir, rmdir, chmod, unlink, dir
fopen, fread, fclose, fwrite, file_exists
closedir, is_dir, readdir.opendir
fileperms.copy, unlink,delfile
disable_functi,fopen,mkdir,rmdir,chmod,unlink,dir
,fopen,fread,fclose,fwrite,file_exists
,closedir,is_dir,readdir.opendir
,fileperms.copy,unlink,delfile
ok, we're done, the PHP Trojan has nothing to do with us. Unfortunately, in this case, those things that use text databases will not be able to be used.
If apache is built on a windos platform, we need to pay attention to one thing. Apache runs with system permissions by default, which is scary and makes people feel uncomfortable. Then let’s lower the permissions of apache.
net user apache fuckmicrosoft /add
net localgroup users apache /del
ok. We created a user apche that does not belong to any group.
We open the computer manager, select services, click on the properties of the apache service, we select log on, select this account, we fill in the account and password created above, restart the apache service, ok, apache is running with low permissions.
In fact, we can also set the permissions of each folder so that the apache user can only perform what we want it to do, and create a separate read-write user for each directory. This is also a popular configuration method among many current virtual host providers, but this method is overkill when used to prevent this.
The above introduces photoshop cs5 official Chinese cracked version download PHP Trojan attack defense skills, including photoshop cs5 official Chinese cracked version download content, I hope it will be helpful to friends who are interested in PHP tutorials.