「php.ini」- 配置参数(学习笔记)

  CREATED BY JENKINSBOT

PHP v7.1.1,几点建议:
在修改 php.ini 的时,建议先打印 调用ini_get_all函数,确定需要配置的参数是在程序里修改的还是在php.ini中修改的;
如果要查看php.ini参数解释:http://php.net/manual/en/ini.list.php
建议查看 英文 版本的,中文版本的更新慢,有些解释不是很完整;

Language Options

; Enable the PHP scripting language engine under Apache.
; http://php.net/engine
engine = On

http://php.net/short-open-tag
short_open_tag = Off

; 浮点数显示的有效数字位数。http://php.net/precision
precision = 14

; 或者查看官方文档
output_buffering = 4096

; 或者查看官方文档
output_handler =

; http://php.net/implicit-flush
implicit_flush = Off

Miscellaneous

; 如果打开在响应头里会有:“X-Powered-By: PHP/7.1.1”。http://php.net/expose-php
; 如果不想暴露服务器中的PHP,可以关闭;
expose_php = On

Resource Limits

; 每个脚本的最大执行时间(秒)。http://php.net/max-execution-time
;**: 在 CLI SAPI 中,该值直接硬编码为0;
max_execution_time = 30

Error handling and logging

; 控制 PHP 的错误、警告、提示的显示;
; 推荐使用的设置方式是使用“错误等级常量(error level constants)”和“按位操作(bitwise operators)”;
; 默认情况下
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
; those related to E_NOTICE and E_STRICT, which together cover best practices and
; recommended coding standards in PHP.
For performance reasons, this is the
; recommend error reporting setting. Your production server shouldn’t be wasting
; resources complaining about best practices and coding standards. That’s what
; development servers and development settings are for.
;
; 下面是错误等级常量:
; E_ALL —————————————————- 显示全部错误 (includes E_STRICT as of PHP 5.4.0)
; E_ERROR ———————————————– 致命的运行时错误;
; E_RECOVERABLE_ERROR ——————– 几乎致命的运行时错误;
; E_WARNING – ——————————— 运行时警告;
; E_PARSE ————————————– 编译时的转化错误;
; E_NOTICE – run-time notices (these are warnings which often result
; from a bug in your code, but it’s possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it is automatically initialized to an
; empty string)
; E_STRICT – run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR – fatal errors that occur during PHP’s initial startup
; E_CORE_WARNING – warnings (non-fatal errors) that occur during PHP’s
; initial startup
; E_COMPILE_ERROR – fatal compile-time errors
; E_COMPILE_WARNING – compile-time warnings (non-fatal errors)
; E_USER_ERROR – user-generated error message
; E_USER_WARNING – user-generated warning message
; E_USER_NOTICE – user-generated notice message
; E_DEPRECATED – warn about code that will not work in future versions
; of PHP
; E_USER_DEPRECATED – user-generated deprecation warnings
;
; Common Values:
; E_ALL (Show all errors, warnings and notices including coding standards.)
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; http://php.net/error-reporting
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
; Possible Values:
; Off = Do not display any errors
; stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
; On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = Off

; 把日志输出到指定文件;默认情况下该值为空;http://php.net/error-log
; Example:
;error_log = php_errors.log
; Log errors to syslog (Event Log on Windows).
;error_log = syslog

auto_prepend_file =
; 在执行主文件之前执行的PHP脚本文件。
; 文件的引入方式类似于require,所以include_path会被使用。
; http://php.net/auto-prepend-file

auto_append_file =
; 主文件执行完之后要执行的PHP脚本文件。
; 文件的引入方式类似于require,所以include_path会被使用。
; 注意:如果主脚本中使用了exit(),那么auto_append_file指定的PHP脚本不会被执行。(可以考虑在auto_prepend_file指定的文件中使用register_shutdown_function函数)
; http://php.net/auto-append-file

; PHP 默认的字符集是 UTF-8。http://php.net/default-charset
default_charset = “UTF-8”

; 是否支持文件上传;http://php.net/file-uploads
file_uploads = On

upload_tmp_dir =
; 由HTTP上传的文件的临时存储文件夹。未指定时,上传文件的保存目录为系统的临时目录。
; Linux: /tmp
; Windows: C:\Users\<Username>\AppData\Local\Temp
; 默认值为NULL。
; http://php.net/upload-tmp-dir

; 上传文件的最大大小。 http://php.net/upload-max-filesize
; 实际中 nginx 也会限制请求body的大小,client_max_body_size;
upload_max_filesize = 2M

; 单次请求的最大文件数,默认不能超过20;
max_file_uploads = 20

; session使用的cookie的Key值(在Cookie中 PHPSESSID=mrs85ktvmfev3ae82p04madp32;)。http://php.net/session.name
session.name = PHPSESSID

; 收到请求的时候,自动初始化session
; http://php.net/session.auto-start
session.auto_start = 0