cvs: phpdoc / manual.xml.in /en/features safe-mode.xml

From: Date: Tue, 10 Jul 2001 20:33:01 +0000
Subject: cvs: phpdoc / manual.xml.in /en/features safe-mode.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969336107@lists.php.net to get a copy of this message
jeroen Tue Jul 10 16:33:01 2001 EDT Added files: /phpdoc/en/features safe-mode.xml Modified files: /phpdoc manual.xml.in Log: Quick and dirty xml-ation of the safe-mode sheet by Rasmus. Doesn't build because of FAQ :( Index: phpdoc/manual.xml.in diff -u phpdoc/manual.xml.in:1.72 phpdoc/manual.xml.in:1.73 --- phpdoc/manual.xml.in:1.72 Tue Jul 10 05:56:07 2001 +++ phpdoc/manual.xml.in Tue Jul 10 16:33:01 2001 @@ -63,12 +63,12 @@ &features.remote-files; &features.connection-handling; &features.persistent-connections; + &features.safe-mode; </part> <part id="funcref"> <title>&FunctionReference;</title> &functions.apache; - &functions.array; &functions.aspell; &functions.bc; Index: phpdoc/en/features/safe-mode.xml +++ phpdoc/en/features/safe-mode.xml <chapter id="features.safe-mode"> <title>Safe mode</title> <para> 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. </para> <para> The configuration directives that control safe mode are: <programlisting role="ini"> 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 = </programlisting> </para> <para> 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: <computeroutput> -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 </computeroutput> Running this script.php <programlisting role="php"> <?php readfile('/etc/passwd'); ?> </programlisting> results in this error when safe mode is enabled: <computeroutput> 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 </computeroutput> </para> <para> 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): <programlisting role="ini"> &lt;Directory /docroot&gt; php_admin_value open_basedir /docroot &lt;/Directory&gt; </programlisting> If you run the same script.php with this open_basedir setting then this is the result: <computeroutput> Warning: open_basedir restriction in effect. File is in wrong directory in /docroot/script.php on line 2 </computeroutput> </para> <para> You can also disable individual functions. If we add this to our php.ini file: <programlisting role="ini"> disable_functions readfile,system </programlisting> Then we get this output: <computeroutput> Warning: readfile() has been disabled for security reasons in /docroot/script.php on line 2 </computeroutput> </para> </chapter> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -->

« previous php.doc (#969336107) next »