Apache and PHP security settings in Linux

Source: Internet
Author: User
Source: irobotsblog (1) safe_mode: run php in safe mode; in php. in the INI file, use the following safe_modeOn (use security mode) safe_modeOff (disable security mode) in apache httpd. the corresponding setting method of VirtualHost in conf: php_admin_flagsafe_modeOn (use security

Source: irobots blog

(1) safe_mode: run php in safe mode;
Use the following in the php. ini file:
Safe_mode = On (use security mode)
Safe_mode = Off (disable security mode)
How to set VirtualHost in httpd. conf of apache
Php_admin_flag safe_mode On (use security mode)
Php_admin_flag safe_mode Off (disable security mode)
Or:
Php_admin_value safe_mode 1 (use security mode)
Php_admin_value safe_mode 0 (disable security mode)

(2) safe_mode_include_dir: Directory without UID/GID check;

(3) open_basedir: restrict the files that can be operated by users to a directory;
A. how to set Directory in httpd. conf of Apache:
Php_admin_value open_basedir/usr/local/apache/htdocs/:/tmp/
B. set open_basedir =.:/tmp/in php. ini, which indicates that
Access the current directory (the directory where the php file is located) and/tmp/directory.

(4) disable_functions: sets the disable function;
Typical security configuration
Disable_functions = shell_exec, system, exec, passthru, show_source, get_var _var, dl
If you are allowed to debug the program, the configuration is as follows:
Disable_functions = shell_exec, system, exec, passthru

(5) register_globals: disable registration of global variables;
Register_globals = On (automatically registered as a global variable)
Register_globals = Off (cannot be registered as a global variable)

(6) magic_quotes_gpc: escape sensitive characters
Magic_quotes_gpc = On
Magic_quotes_gpc = Off
In Apache httpd. conf, set VirtualHost as follows:
Php_admin_flag magic_quotes_gpc on
Or:
Php_admin_value magic_quotes_gpc 1

Related Article

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.