Results 1 to 6 of 6

Thread: Explain me about the Safe Mode in PHP?

  1. #1
    Join Date
    Aug 2006
    Posts
    300

    Explain me about the Safe Mode in PHP?

    Hi friends,
    I have done the study of PHP programming language to a better extent. I am using an older version of PHP, and I want to know about the safe-mode. I came to know that it is used for solving the security issue. But I don't know much about it, so thought that posting here would help me.!! Please explain me about the Safe Mode in PHP? Hope that you guys would reply me soon.!!

  2. #2
    Join Date
    Jul 2006
    Posts
    289

    Re: Explain me about the Safe Mode in PHP?

    The "Safe Mode" is the way PHP security: a solution to the problem of sharing of PHP on a server. It is architecturally incorrect to try to solve this problem at the PHP level, but since the alternatives at the web server. But the alternatives at the web server and OS levels are not realistic. Many stakeholders, including ISP's, use safe mode. You should know that the "Safe Mode" is deprecated since PHP 5.3.0 and was removed in PHP 6.0.0. suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.
    Signatures reduce available bandwidth

  3. #3
    Join Date
    Aug 2006
    Posts
    227

    Re: Explain me about the Safe Mode in PHP?

    The following are the configuration directives with an explanation :
    • safe_mode boolean - Whether to enable the security mode for PHP. If PHP is compiled with - enable-safe-mode, the default is On, Off otherwise.
    • safe_mode_gid boolean - By default, Safe Mode does a UID compare check when opening a file. If you want to relax a bit this level of security, you can perform a comparison group, then turn on safe_mode_gid. If this directive is FALSE (the default) is a comparison of the UID, and if it is TRUE is a comparison of the GID.
    • safe_mode_include_dir string - Audits based on the UID or GID are ignored when the included files are placed in the folder specified by this directive and its subfolders. Cases may also be in the include_path or it must include the full path.
    • safe_mode_exec_dir string - If PHP is used in safe mode, functions like system () and all those that run in command line will refuse to run programs that are not in this folder. You must use / as directory separator in all environments, including Windows.
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  4. #4
    Join Date
    Mar 2008
    Posts
    349

    Re: Explain me about the Safe Mode in PHP?

    I am providing you with the more configuration directives that are used in safe mode :
    • safe_mode_allowed_env_vars string - Setting certain environment variables is a potential security hole. This directive contains a list of names of environment variables separated by commas, or prefixes. In Safe Mode, the user may only alter environment variables whose names begin with the prefixes supplied here. By default, users can modify the environment variables that begin with PHP_. If this directive is empty, PHP will let the user modify ANY environment variable.
    • safe_mode_protected_env_vars string - This directive contains a list of environment variables that the programmer can not modify it using the function putenv (). These variables will be protected even if safe_mode_allowed_env_vars permits their amendment.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Explain me about the Safe Mode in PHP?

    When Safe Mode is enabled, PHP checks whether the owner of the current script is the same as the owner of files or folders that will be handled by this script. For example, in the following situation :
    1. -rw-rw-r-- 1 rasmus rasmus 33 Oct 7 22:20 script.php
    2. -rw-r--r-- 1 root root 1116 Dec 26 19:01 /etc/passwd

    Running script.php :
    PHP Code:
    <?php
     readfile
    ('/etc/passwd'); 
    ?>
    results in this error when safe mode is enabled :
    Code:
    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

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: Explain me about the Safe Mode in PHP?

    The following is the list of a non-exhaustive list of functions disabled by Safe Mode :
    • dbmopen () - Check the file / folder that you use has the same UID as the script that is being executed.
    • Ifx_ * - sql_safe_mode restrictions, (! = Safe Mode)
    • putenv () - Follows the safe_mode_protected_env_vars and safe_mode_allowed_env_vars.
    • exec () - You can run programs that are on file safe_mode_exec_dir. For practical reasons, it is not possible to use wildcards like in the path of this file.
    • system () - You can run programs that are on file safe_mode_exec_dir.
    • apache_request_headers () - In safe mode, headers beginning with 'authorization' (case sensitive) will not be returned.

Similar Threads

  1. Stuck in safe mode ,cant get in to normal mode
    By gms123 in forum Windows XP Support
    Replies: 6
    Last Post: 12-03-2012, 06:17 PM
  2. Cannot Display Video Mode when booting in Safe Mode
    By oooooniki in forum Monitor & Video Cards
    Replies: 1
    Last Post: 05-05-2011, 10:54 PM
  3. Windows XP won't start in normal mode, only in safe mode.
    By katkoehler in forum Operating Systems
    Replies: 4
    Last Post: 17-05-2009, 03:34 PM
  4. Stuck in Safe Mode in Normal Startup mode need help!
    By kiLLer in forum Windows Vista Performance
    Replies: 1
    Last Post: 24-02-2008, 04:28 PM
  5. Replies: 2
    Last Post: 06-01-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,032,029.10046 seconds with 16 queries