From b7b1757493953aa1345239e7cba10c42b513f697 Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Tue, 10 Jul 2001 20:33:02 +0000 Subject: [PATCH] Quick and dirty xml-ation of the safe-mode sheet by Rasmus. Doesn't build because of FAQ :( git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@51111 c90b9560-bf6c-de11-be94-00142212c4b1 --- features/safe-mode.xml | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 features/safe-mode.xml diff --git a/features/safe-mode.xml b/features/safe-mode.xml new file mode 100644 index 0000000000..17bb877290 --- /dev/null +++ b/features/safe-mode.xml @@ -0,0 +1,85 @@ + + Safe mode + + + Safe Mode is an attempt to solve the shared-server security problem. It is + architecturally incorrect to try to solve this problem at the PHP level, + but since the alternatives at the web server and OS levels aren't very + realistic, many people, especially ISP's, use safe mode for now. + + + The configuration directives that control safe mode are: + +safe_mode = Off +open_basedir = +safe_mode_exec_dir = +safe_mode_allowed_env_vars = PHP_ +safe_mode_protected_env_vars = LD_LIBRARY_PATH +disable_functions = + + + + When safe_mode is on, PHP checks to see if the owner of the current script + matches the owner of the file to be operated on by a file function. For + example: + +-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php +-rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd + + Running this script.php + + + + results in this error when safe mode is enabled: + +Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not +allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2 + + + + If instead of safe_mode, you set an open_basedir directory then all file + operations will be limited to files under the specified directory. For + example (Apache httpd.ini example): + +<Directory /docroot> +php_admin_value open_basedir /docroot +</Directory> + + If you run the same script.php with this open_basedir setting then this is + the result: + +Warning: open_basedir restriction in effect. File is in wrong directory in +/docroot/script.php on line 2 + + + + You can also disable individual functions. If we add this to our php.ini + file: + +disable_functions readfile,system + + Then we get this output: + +Warning: readfile() has been disabled for security reasons in /docroot/script.php on line 2 + + + + +