PHP configuration Open_basedir allow each virtual site to run independently _php tutorial

Source: Internet
Author: User
At that time, I think this is very poor compared to IIS, because in IIS, you can set up a site in security or even a directory access to use the anonymous account, as long as the different sites use the same account, the security between sites will not affect each other. These days only to find that the original idea was wrong, under Apache, you can also configure PHP to achieve the independent operation of each site, although not detailed control to a user to run a site, but at least no longer the entire server is down.

This control can be implemented by configuring PHP Open_basedir, which is also useful under IIS, but only under Apache configuration.

Open_basedir can limit the active scope of user access files to the specified area, usually the path of their home directory, or
Available symbols "." To represent the current directory. Open_basedir can also set up multiple directories at the same time, separate directories in Windows with semicolons, and in any other system
Colon-delimited directory. When it acts on the Apache module, the Open_basedir path in the parent directory is automatically inherited. The following is an example of a Linux system configuration

Method One: Configure in php.ini
Open_basedir =.:/ tmp/

Method Two: Set in Apache config VirtualHost
Php_admin_value Open_basedir.:/ tmp/

Method Three: Set in Apache config Direcotry
Php_admin_value Open_basedir.:/ tmp/

Explanations of the three configuration methods:
A, method two priority is higher than method one, that is, method two will cover method one, the priority of method three is higher than method two, that is, method three will cover method two;
b, the configuration directory in Riga "/tmp/" is because the default PHP temporary files (such as uploaded files, session, etc.) will be placed in the directory, so generally need to add the directory, or some of the functions will not be used;
C. Add "." in the configuration directory. Refers to the current directory where PHP files are run, which avoids one setting per site;
D, if the site also uses a file outside the site directory, you need to set the directory separately in the corresponding virtualhost;

After setting up, remember to find a PHP network horse (such as: Phpspy) to play a play, test there is no problem, no accident, the authority should be quite good control.
Everyone has the experience of PHP security configuration, Welcome to share communication.

http://www.bkjia.com/PHPjc/320852.html www.bkjia.com true http://www.bkjia.com/PHPjc/320852.html techarticle At that time, I think this is too bad compared to IIS, because in IIS, you can set a site in security or even a directory access to use the anonymous account, as long as the various sites use ...

  • 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.