Home > Article > Backend Development > Detailed explanation of php.ini_PHP tutorial
Source: Taotao's blog
; PHP is still an evolving tool, and its functions are still being deleted
; and changes in the settings of php.ini can reflect considerable changes,
; Before using a new PHP version, it would be beneficial to study php.ini
;;;;;;;;;;;;;;;;;;;;; About this file ;
;;;;;;;;;;;;;;;;;;;;
; This file controls many aspects of PHP. In order for PHP to read this file, it must be named
; php.ini. PHP will search for the file in these places in sequence: the current working directory; the path specified by the environment variable PHPRC
;; the path specified during compilation.
; Under Windows, the path when compiling is the Windows installation directory.
; In command line mode, the search path of php.ini can be replaced with the -c parameter.
; The syntax of this file is very simple. Whitespace characters and lines starting with a semicolon; are simply ignored (as you might guess from
; ). Section titles (eg: [Foo]) are also simply ignored, even though they may
; have some meaning in the future.
;
; directives are specified using the following syntax:
; directive identifier = value
; directive = value
; directive identifier is *case-sensitive* - foo=bar differs at FOO = bar.
;
; The value can be a string, a number, a PHP constant (such as: E_ALL or M_PI),
in INI constant; a (On, Off, True, False, Yes, No and None), or an expression
; (such as: E_ALL & ~E_NOTICE), or a string enclosed in quotes ("foo").
;
; Expression of INI file Restricted to bitwise operators and parentheses.
; | bitwise OR
; & bitwise AND
; ~ bitwise NOT
; ! boolean NOT
;
; Boolean flags can be 1, On, True or Yes. These values are placed in open status.
; They can be turned off using the values 0, Off, False or No.
;
; An empty string can be represented by not writing anything after the equal sign, or using the None keyword:
;
; foo = ; Set foo to an empty string
; foo = none ; Set foo to the empty string
; foo = "none" ; Set foo to the string none
;
; If you use constants in value settings, and these constants belong For dynamically loaded extension libraries (not PHP extensions, but
; Zend extensions), you can only use these constants *after* the lines that load these extensions.
;
; All values set in the php.ini-dist file are the same as the built-in default values (that is, if php.ini
; is not used or you delete them row, the default value is the same).
;;;;;;;;;;;;;;;;;;;;;;
; Language options;
;;;;;;;;;;; ;;;;;;;;;
engine = On
; Make the PHP scripting language engine (PHP scripting language engine) valid under Apache.
short_open_tag = On
; allows tags to be recognized.
asp_tags = Off
; Allow ASP-style tags
precision = 14
; The number of significant digits when displaying floating point type numbers
y2k_compliance = Off
; Whether to turn it on Year 2000 Adaptation (may cause issues in non-Y2K Adapted browsers)
output_buffering = Off
; Output buffering allows you to send header (including cookies) lines even after outputting the body content
; The price is that the output layer slows down a little. You can use Output Cache to turn on output caching at runtime,
; or set the directive to On here to turn on output caching for all files.
output_handler = ; You can redirect all output of your script to a function,
; that might be useful for processing or logging it.
; For example, if you set this output_handler to "ob_gzhandler",
; the output will be transparently compressed for browsers that support gzip or deflate encoding.
; Set an output processor to automatically open output buffering.
implicit_flush = Off
; Force flush to let PHP tell the output layer to automatically refresh its own data after each output block.
; This is equivalent to calling the flush() function after every print() or echo() call and after every HTML block.
; Turning on this setting will cause serious runtime conflicts. It is recommended to turn it on only during debugging.
allow_call_time_pass_reference = On
; Whether to force parameters to be passed by reference when calling the function. This method was protested
; and may no longer be supported in future versions of PHP/Zend.
; It is encouraged to specify which parameters are passed by reference in the function declaration.
; You are encouraged to try turning this option off and verify that your scripts still work, to ensure that they will still work
; in future versions of the language. (You will get a warning every time you use this feature, and arguments will be passed by value rather than by reference
;).
; Safe Mode Safe Mode
safe_mode = Off
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
; ? Setting certain environment variables
; ? may be a potential security breach.
; The directive contains a comma-separated list of prefixes. In safe mode, users can only replace
; with the values of environment variables that begin with the prefixes listed here.
; By default, users will only be able to set environment variables starting with PHP_ (eg: PHP_FOO=BAR).
; Note: If this directive is empty, PHP will let the user change any environment variables!
safe_mode_protected_env_vars = LD_LIBRARY_PATH
; This directive contains a comma-separated list of environment variables that are End users will not be able to change it with putenv().
; These variables are protected even when safe_mode_allowed_env_vars is set to allowed.
disable_functions =
; This directive allows you to disable specific functions for security reasons.
; It accepts a comma separated list of function names.
; This instruction is *not* affected by whether Safe Mode is turned on.
; Color of syntax highlighting mode.
; Anything acceptable will work.
highlight.string = #DD0000
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg = #FFFFFF
highlight.default = #0000BB
highlight.html = #000000
; Misc Misc
expose_php = Off
; Determines whether PHP should indicate the fact that it is installed on the server (for example: add it - PHP - to the web service
; on the signal sent).
; (My personal opinion is to turn this off when any power-by header appears.)
; It does not pose a security threat, but it makes it possible to check whether it is installed on your server. Made possible with PHP.
;;;;;;;;;;;;;;;;;;;;;
; Resource Limits;
;;;;;;;;;;;; ;;;;;;;
max_execution_time = 30 ; The maximum execution time of each script, in seconds
memory_limit = 8388608 ; The maximum total amount of memory that can be used by a script (here is 8MB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
; Error control and registration;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error reporting is bitwise. Or add up the numbers to get the desired error reporting level.
; E_ALL - all errors and warnings
; E_ERROR - fatal runtime errors
; E_WARNING - runtime warnings (non-fatal errors)
; E_PARSE - compile-time parsing errors
; E_NOTICE - runtime reminder (these are often caused by bugs in your code,
; may also be caused by intentional behavior. (eg: automatic initialization of an uninitialized variable to a
; null character based on string fact)
; E_CORE_ERROR - Fatal error that occurred during the initialization process when PHP started
; E_CORE_WARNING - Warning (non-fatal) that occurred during the initialization process when PHP started E_COMPILE_ERROR - compile-time fatal error
; E_COMPILE_WARNING - compile-time warning (non-fatal error)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning Message
; E_USER_NOTICE - User generated reminder message
; Example:
; error_reporting = E_ALL & ~E_NOTICE ; Show all errors except reminder
; error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; Show only Errors
error_reporting = E_ALL & ~E_NOTICE ; Display all errors except alerts
display_errors = On ; Display error messages (as part of the output)
; On the final published web site, it is strongly recommended that you Turning off this feature and using
; error logging instead (see below).
; Continuing to enable display_errors on the final published web site may
; expose some security-related information about your web service.
; Your database configuration or other information.
display_startup_errors = Off ; Even when display_erroes is turned on, errors that occur during the PHP startup step
; will not be displayed. .
; It is strongly recommended to keep display_startup_errors turned off,
; except during error correction.
log_errors = Off; Log errors in the log file (server specified log, stderr standard error output, or error_log( below))
; As noted above, it is strongly recommended that you log errors
; on the final published web site instead of direct error output.
track_errors = Off ; Save the latest error/warning message in the variable $php_errormsg (boolean)
;error_prepend_string = "" ; The string output before the error message
;error_append_string = "" ; The string output after the error message
; error_log = filename; Record the error log in the specified file
; error_log = syslog; Record the error log in the system log syslog (event log under NT, invalid under Windows 95)
warn_plus_overloading = Off ; Warn when using '+' for strings
;;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
variables_order = "EGPCS" ; This directive describes the PHP record
; GET, POST, Cookie, Environment and Built- in the order of these variables.
; (represented by G, P, C, E & S, often referred to as EGPCS or GPC).
; Records from left to right, with new values replacing old ones.
register_globals = On ; Whether to register these EGPCS variables as global variables.
; You may want to turn this off if you don't want user data to be cluttered globally.
; This makes more sense in conjunction with track_vars — that way you can access all GPC variables via the
; $HTTP_*_VARS[] array.
register_argc_argv = On; This instruction tells PHP whether to declare the argv and argc variables
; (Note: here argv is an array and argc is the number of variables)
; (which includes the GET method) data).
; If you don't want to use these variables, you should turn them off to improve performance.
track_vars = On ; Make $HTTP_*_VARS[] count