Now many sites are using PHP to build stations, many are directly using the mature CMS program, these PHP development of the CMS system itself may not be high security, then we need to do some of the server for PHP program to configure anti-cross station, anti-directory, and other settings, It can effectively prevent all PHP sites on the server from being tampered with maliciously.
Scope of application and demo system
Scope of application: php5.3 and the above version
Demo System: CentOS
Anti-Cross station, anti-cross Directory security setting method
Step 1th: Log on to the Linux system terminal.
2nd step: Locate and open the PHP configuration file.
Step 3rd: Add the following code at the bottom of the php.ini and save it. You can change the following code into their own site configuration can be.
[Host=www.45it.com]
open_basedir=/wwwroot/www.45it.com/:/tmp/
[Path=/wwwroot/www.45it.com]
open_basedir=/wwwroot/www.45it.com/:/tmp/
Note: As soon as the code is added after the anti-cross site to prevent cross-directory security configuration, but there are some shortcomings, that is, for example, we run some PHP probes, such as some programs may not be normal operation, if you want to let the site normal operation of PHP probes need to be added after/tmp/:
4th step: Add the code and save the php.ini, and then restart the PHP service can take effect.