Home >Backend Development >PHP Tutorial >Chinese comments on the PHP configuration file PHP.INI_PHP tutorial
这里非常详细的介绍了php.ini的配置文件.很多php的错误都可以从这里的配置得到解决! 这个文件控制了PHP许多方面的观点。为了让PHP读取这个文件,它必须被命名为 ; 该文件的语法非常简单。空白字符和用分号´;´开始的行被简单地忽略(就象你可能 engine = On y2k_compliance = Off output_buffering = Off implicit_flush = Off allow_call_time_pass_reference = On ; Safe Mode 安全模式 safe_mode_protected_env_vars = LD_LIBRARY_PATH disable_functions = ; Color of syntax highlighting mode. highlight.string = #DD0000 ; Misc Misc max_execution_time = 30 ; The maximum execution time of each script, in seconds ; E_CORE_ERROR - Fatal error that occurs during the initialization process of PHP startup log_errors = Off ; Record errors in a log file (server-specific log, stderr standard error output, or error_log (below)) track_errors = Off ; Save the latest error/warning message in variable $php_errormsg (boolean) register_globals = On ; Whether to register these EGPCS variables as global variables. register_argc_argv = On; This instruction tells PHP whether to declare the argv and argc variables track_vars = On; Make the $HTTP_*_VARS[] array valid, here * is used when using
; ´php.ini´。PHP 将在这些地方依次查找该文件:当前工作目录;环境变量PHPRC
; 指明的路径;编译时指定的路径。
; 在windows下,编译时的路径是Windows安装目录。
; 在命令行模式下,php.ini的查找路径可以用 -c 参数替代。
; 猜到的一样)。 章节标题(例如 : [Foo])也被简单地忽略,即使将来它们可能
; 有某种的意义。
;
; 指示被指定使用如下语法:
; 指示标识符 = 值
; directive = value
; 指示标识符 是 *大小写敏感的* - foo=bar 不同于 FOO = bar。
;
; 值可以是一个字符串,一个数字,一个 PHP 常量 (如: E_ALL or M_PI), INI 常量中的
; 一个 (On, Off, True, False, Yes, No and None) ,或是一个表达式
; (如: E_ALL & ~E_NOTICE), 或是用引号括起来的字符串("foo").
;
; INI 文件的表达式被限制于位运算符和括号。
; | bitwise OR
; & bitwise AND
; ~ bitwise NOT
; ! boolean NOT
;
; 布尔标志可用 1, On, True or Yes 这些值置于开的状态。
; 它们可用 0, Off, False or No 这些值置于关的状态。
;
; 一个空字符串可以用在等号后不写任何东西表示,或者用 None 关键字:
;
; foo = ; 将foo置为空字符串
; foo = none ; 将foo置为空字符串
; foo = "none" ; 将foo置为字符串´none´
;
; 如果你值设置中使用常量,而这些常量属于动态调入的扩展库(不是 PHP 的扩展,就是
; Zend 的扩展),你仅可以调入这些扩展的行*之后*使用这些常量。
;
; 所有在 php.ini-dist 文件里设定的值与内建的默认值相同(这是说,如果 php.ini
; 没被使用或者你删掉了这些行,默认值与之相同)。
;;;;;;;;;;;;;;;;;;;;
; 语言选项 ;
;;;;;;;;;;;;;;;;;;;;
; 使 PHP scripting language engine(PHP 脚本语言引擎)在 Apache下有效。
short_open_tag = On
; 允许 <? 标识(这种简单表示)。否则 仅有 <?php and <script> tags 将被识别。
asp_tags = Off
; 允许ASP-style <% %> tags
precision = 14
; 浮点类型数显示时的有效位数
; 是否打开 2000年适应 (可能在非Y2K适应的浏览器中导致问题)
; 输出缓存允许你甚至在输出正文内容之后发送 header(标头,包括cookies)行
; 其代价是输出层减慢一点点速度。你可以使用输出缓存在运行时打开输出缓存,
; 或者在这里将指示设为 On 而使得所有文件的输出缓存打开。
; 强制flush(刷新)让PHP 告诉输出层在每个输出块之后自动刷新自身数据。
; 这等效于在每个 print() 或 echo() 调用和每个 HTML 块后调用flush()函数。
; 打开这项设置会导致严重的运行时冲突,建议仅在debug过程中打开。
; 是否让强迫函数调用时按引用传递参数。这一方法遭到抗议,
; 并可能在将来版本的PHP/Zend里不再支持。
; 受到鼓励的指定哪些参数按引用传递的方法是在函数声明里。
; 你被鼓励尝试关闭这一选项并确认你的脚本仍能正常工作,以保证在将来版本的语言里
; 它们仍能工作。(你将在每次使用该特点时得到一个警告,而参数将按值而不是按引用
; 传递)。
safe_mode = Off
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
; ?Setting certain environment variables
; ?may be a potential security breach.
; 该指示包含用逗号分隔的前缀列表。安全模式中,用户仅可以替换
; 以在此列出的前缀开头的环境变量的值。
; 默认地,用户将仅能 设定以PHP_开头的环境变量,(如: PHP_FOO=BAR)。
; 注意: 如果这一指示为空,PHP 将让用户更改任意环境变量!
; 这条指示包含一个用逗号分隔的环境变量列表,那是最终用户将不能用putenv () 更改的。
; 这些变量甚至在safe_mode_allowed_env_vars 设置为允许的情况下得到保护。
; 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.
; Anything acceptable by will work.
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg = #FFFFFF
highlight.default = #0000BB
highlight. html = #000000
expose_php = Off
; Determines whether PHP should indicate the fact that it is installed on the server (for example: add to the signal it —PHP— sends to the Web service
;).
; (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 ;
;;;;;;;;;;;;;;; ;;;;
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 using an uninitialized variable)
; E_CORE_WARNING - Warning (non-fatal error) that occurs during the initialization process of PHP startup
; E_COMPILE_ERROR - Fatal error during compilation
; 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 reminders
; error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; Show only errors
error_reporting = E_ALL & ~E_NOTICE ; Show all Errors, in addition to reminders
display_errors = On ; display error messages (as part of the output)
; On the final published web site, it is strongly recommended that you turn off this feature and use
; error logs instead (see below).
; Continuing to enable display_errors on the final published web site may
; expose some security-related information, such as file paths on your web service,
; your database configuration, or other information.
; As stated above, it is strongly recommended that you log errors in the final published web site Log errors
; instead of direct error output.
;error_prepend_string = "<font color=ff0000>" ; in error String output before the message
; error_append_string = "</font>" ; String output after the error message
; error_log = filename ; Record the error log in the specified file
; error_log = syslog ; Record The error log is 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 order in which PHP records
; GET, POST, Cookie, Environment and Built-in 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.
; 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 - this way you can access all via the
; html#" target=_blank>$HTTP_*_VARS[] array GPC variables
; (Note: here argv is an array and argc is the number of variables)
; (which contains data passed by the GET method) .
; If you don't want to use these variables, you should turn them off to improve performance.