Answer the question
In order to leave comments, you need to log in
How to set up security for extensible sites?
Task: host several sites on one server. Problem: a user of one site can write a script that will fit into another site or go to roam the top-level directories. How to restrict access to php scripts to directories above the specified one?
Answer the question
In order to leave comments, you need to log in
For example like this
open_basedir string
Restricts the specified directory tree to the files that can be accessed by PHP, including the file itself. This directive is NOT affected by safe mode.
When a script tries to access a file, for example with fopen() or gzopen(), the location of the file is checked. If the file is outside the specified directory tree, PHP will refuse to open it. All symbolic links will be expanded, so there is no way around this restriction. If the file does not exist, then the symbolic link cannot be read and the filename (read) will be considered by open_basedir .
The open_basedir option can extend to more than just file system functions; for example, if MySQL is configured to use the mysqlnd driver, then LOAD DATA INFILE falls under the open_basedir option. Many PHP functions also use open_basedir.
This is a stupid decision, all sites must be from different users and with normal rights and
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question