;;;;;;;;;;;;
; Syntax ;;
; The syntax of this file is very simple. Blank characters and rows starting with semicolons are ignored.
Chapter titles (for example, [PHP]) are also ignored, even if they may make some sense in the future.
Set the command format as follows:
; Directive = Value
; Directive name (direve VE) is case sensitive! Therefore, "foo = bar" is different from "foo = bar ".
; Value can be:
; 1. A string defined by quotation marks (for example, "foo ")
; 2. A number (integer or floating point number, such as: 0, 1, 34,-1, 33.55)
3. a PHP constant (for example, e_all, m_pi)
4. An ini constant (On, off, none)
; 5. An expression (for example, e_all &~ E_notice)
The expression in the INI file only uses the bitwise operator, non-logical, and parentheses:
; | Bit or
; & Bit and
;~ Bitwise
;! Non-logical
; Boolean indicates opening with ON and off with off.
An empty string can be used after the equal sign without any representation, or with the none Keyword:
; Foo =; Set Foo as an empty string
; Foo = none; Set Foo as an empty string
; Foo = "NONE"; Set Foo as the string 'none'
If you use constants in the command value dynamic extension (PhP extension or Zend extension,
You can only use these constants after loading these dynamically scalable command lines.
; Httpd. conf ;;
You can also overwrite the php. ini value in httpd. conf for more flexible configuration:
; Php_value name value; specifies a non-bool instruction. If the value is set to none, the previous setting is cleared.
; Php_flag name on | off; only used to set bool commands
PHP constants (such as e_all) can only be used in PHP. ini. The corresponding mask value must be used in httpd. conf.
; Commands with the "sys" flag can only be used in the global configuration section of httpd. conf.
; [Updated, added more information about PhP6 and corrected and added some information according to the PHP-5.2.2]
; ========================================================== =====
;; ============ Detailed instructions
; ========================================================== =====
; The setting value for each of the following commands is the same as the default value built into the PHP-5.2.2.
That is, if 'php. ini 'does not exist, or you have deleted some rows, the default value is the same.
;;;;;;;;;;;;;;
; Apache ;;
[Apache]
; Is valid only when PHP is used as the Apache module.
Child_terminate = off
; PHP scripts allow the use of the apache_child_terminate () function to stop child processes after the request ends.
This command is only available when PHP is installed as apache1.3 on UNIX platforms. It does not exist in other cases.
Engine = on
Whether to enable the PHP parsing engine.
Tip: You can enable or disable the PHP parsing engine in httpd. conf Based on directories or virtual hosts.
Last_modified = off
Whether to place the last modification time of the PHP script in the last-modified response header.
Xbithack = off
Whether or not the end of the file is parsed as a PHP executable bit group.
; PHP core ;;
[PHP-core-datetime]
The first four configuration options are currently only used for date_sunrise () and date_sunset () functions.
Date. default_latitude = 31.7667
; Default latitude
Date. default_longpolling = 35.2333
; Default longitude
Date. Sun rise_zenith = 90.583333
By default
Date. sunset_zenith = 90.583333
By default, the sunset is at the top of the day.
Date. timezone =
; The default time zone used for all date and time functions when TZ environment variables are not set.
; "PRC" should be used in Mainland China"
The priority of the application time zone is:
; 1. Use the time zone set by the date_default_timezone_set () function (if set)
; 2. TZ environment variable (if not empty)
; 3. The value of this command (if set)
4. php speculation (if supported by the operating system)
; 5. If none of the preceding operations are successful, use UTC
[PHP-core-assert]
Assert. Active = on
; Whether to enable assert () assert Evaluation
Assert. Bail = off
; Whether to abort script execution in the event of a failure assertion
Assert. Callback =
; The callback function executed when an assertion fails.
Assert. quiet_eval = off
; Whether to use quiet evaluation (no error message is displayed, which is equivalent to error_reporting = 0 ).
If it is disabled, the current error_reporting command value is used to evaluate the asserted expression.
Assert. Warning = on
; Whether to give a warning to each failure assertion
[PHP-core-safemode]
The security mode is set up to solve the security problem of the Shared Server.
But it is unreasonable in structure to try to solve this problem at the PHP layer,
The correct method should be to modify the Web server layer and operating system layer.
Therefore, in PhP6, the security mode is removed and open_basedir-based security protection is used.
; All commands have been deleted in PhP6.
Safe_mode = off
; Sys
Whether to enable the security mode.
When the script is enabled, PHP checks whether the owner of the current script is the same as the owner of the operated file,
If they are the same, the operation is allowed. Otherwise, the operation is denied.
Safe_mode_gid = off
; Sys
In safe mode, the UID comparison check is performed by default during file access.
But in some cases, strict uid check is not suitable, and the loose GID check is enough.
If you want to extend it to GID-only comparison, you can open this parameter.
Safe_mode_allowed_env_vars = "PHP _"
; Sys
In security mode, you can only change the prefix list of environment variables (separated by commas ).
; Allows you to set certain environment variables, which may lead to potential security vulnerabilities.
Note: If this parameter is null, PHP allows you to change any environment variable!
Safe_mode_protected_env_vars = "LD_LIBRARY_PATH"
; Sys
In security mode, you cannot change the list of environment variables (separated by commas ).
These variables are protected even when the safe_mode_allowed_env_vars command is set to allow.
Safe_mode_exec_dir = "/usr/local/PHP/bin"
; Sys
In security mode, only the executable files in this directory can be executed.ProgramTo allow function execution of the executed system program.
These functions are: system, escapeshellarg, escapeshellcmd, exec, passthru,
; Proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec
Safe_mode_include_dir =
; Sys
In security mode, the UID/GID check will be skipped when the group directory and files in its subdirectories are included.
In other words, if the value here is null, any file with a UID/GID that does not match is not allowed to be included.
The directory set here must already exist in the include_path command or be included in the full path.
Multiple directories are separated by colons (semicolons in Win.
; The specified restriction is actually a prefix instead of a directory name,
That is, "/DIR/incl" will allow access to "/DIR/include" and "/DIR/incls"
If you want to control access to a specified directory, add a slash at the end.
[PHP-core-safe]
Allow_url_fopen = on
; Sys
; Whether to allow remote file opening
Allow_url_include = off
; Sys
; Whether to allow include/require remote files.
Disable_classes =
; Sys
This command accepts a list of class names separated by commas to disable specific classes.
Disable_functions =
; Sys
This command accepts a list of function names separated by commas (,) to disable specific functions.
Enable_dl = on
; Sys
Whether to use the DL () function. The DL () function is only valid when PHP is installed as an Apache module.
The DL () function is disabled mainly for security reasons because it can bypass the restrictions of the open_basedir command.
; Always disable the DL () function in safe mode, regardless of how it is set here.
The command is deleted in PhP6, which is set to off.
Expose_php = on
; Sys
Whether to expose the fact that PHP is installed on the server (add the signature in the HTTP header ).
It does not directly threaten security, but it makes the client know that PHP is installed on the server.
Open_basedir =
; Sys
Restrict all files allowed by PHP (including files themselves) to the list of directories in this group.
When a script tries to open a file outside the specified directory tree, it will be rejected.
All symbolic connections are parsed, so it is impossible to avoid this restriction through symbolic connections.
The special value '.' specifies the directory where the script is stored as the benchmark directory.
But this is dangerous because the working directory of the script can be easily changed by chdir.
For shared servers, it is very useful to set the command flexibly in httpd. conf.
In Windows, use semicolons to separate directories, and use colons to separate directories in UNIX.
As the Apache module, the open_basedir path in the parent directory is automatically inherited.
; The specified restriction is actually a prefix instead of a directory name,
That is to say, "/DIR/incl" will allow access to "/DIR/include" and "/DIR/incls ",
If you want to control access to a specified directory, add a slash at the end.
By default, all files are allowed to be opened.
SQL. safe_mode = off
; Sys
Whether to use SQL security mode.
If enabled, database connection functions with default values will use these default values to replace the supported parameters.
For the connection functions of different databases, see the corresponding manual page for the default values.
[PHP-core-Error]
Error_reporting = e_all &~ E_notice
The error report level is the superposition of bit fields. We recommend that you use e_all | e_strict
; 1 e_error fatal runtime error
; 2 e_warning runtime warning (non-fatal error)
4. parsing error during e_parse Compilation
; 8 e_notice runtime reminder (often a bug or intentionally)
; 16 e_core_error fatal error during PHP startup
32 _ core_warning warning during initialization (non-fatal error) during PHP startup)
; 64 e_compile_error fatal error during compilation
; 128 e_compile_warning warning during compilation (non-fatal error)
256 User-Defined fatal error
; 512 user_warning User-Defined warning (non-fatal error)
1024 e_user_notice User-Defined notifications (often bugs, or intentionally)
; 2048 e_strict code standardization warning (how to modify to forward compatibility)
; 4096 e_recoverable_error is close to a fatal runtime error. If it is not captured, it is treated as e_error.
; 6143 all except e_strict errors (8191 in PhP6, that is, all errors)
Track_errors = off
; Whether to save the most recent error or warning message in the variable $ php_errormsg.
Display_errors = on
Whether to display the error information as part of the output.
On the final web site, we strongly recommend that you disable this feature and use error logs instead (see below ).
Opening this feature on the final web site may expose some security information,
For example, the file path, database plan, or other information on your web service.
Display_startup_errors = off
; Whether to display PHP startup errors.
Even if the display_errors command is enabled, disabling this parameter does not display errors during PHP startup.
We recommend that you disable this feature unless you must use it for debugging.
Report_memleaks = on
Whether to report Memory leakage. This parameter only works in PHP compiled by debugging,
And the error_reporting command must contain e_warning
Report_zend_debug = on
; No instructions
Html_errors = on
Whether to use HTML in the error message.
Note: Do not use this feature on the released site!
Docref_root =; "http: // localhost/phpmanual /"
Docref_ext =; ". html"
If the html_errors command is enabled, PHP will display the hyperconnection in the error message,
Directly link to a page that describes this error or the function that causes this error.
You can download the PHP manual from http://www.php.net/docs.php,
And direct the docref_root command to the URL directory of your local manual.
You must also set the docref_ext command to specify the file extension (which must contain '.').
Note: Do not use this feature on published sites.
Error_prepend_string =; "<font color = # f00>"
The string that is output before the error message.
Error_append_string =; "</font>"
The string output after the error message.
Xmlrpc_errors = off
; Sys
Xmlrpc_error_number = 0
; No documentation
[PHP-core-logging]
Define_syslog_variables = off
Whether to define various System Log variables, such as $ log_pid and $ log_cron.
It is a good idea to turn it off to improve efficiency.
You can call the define_syslog_variables () function at runtime to define these variables.
Error_log =
The file to which the error log is recorded. This file must be writable to Web Server users.
Syslog indicates that the logs are recorded in system logs (Event Logs under NT, Syslog logs under Unix (3 ))
If no value is set here, the error will be recorded in the web server error log.
Log_errors = off
; Whether an error is recorded in the log file. the specific location of the error is determined by the error_log command.
It is strongly recommended that you use logging errors instead of directly outputting them when the final web site is released,
In this way, you can know that there is a problem and no sensitive information is exposed.
Log_errors_max_len = 1024
Set the maximum length of the error source associated with the error message appended to the error log.
The value set here is valid for both the displayed and recorded errors and $ php_errormsg.
The value 0 allows an infinite length.
Ignore_repeated_errors = off
; Whether to ignore duplicate error messages when logging errors.
; The error message must appear in the same row of the same file.
Ignore_repeated_source = off
; Whether to ignore duplicate error sources when ignoring duplicate error messages.