PHP Configuration Anti-Cross station, anti-cross directory security

Source: Internet
Author: User
Tags ini

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.