运行时配置
这些函数的行为受 php.ini 中的设置影响。
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
assert.active | "1" | PHP_INI_ALL | |
assert.bail | "0" | PHP_INI_ALL | |
assert.warning | "1" | PHP_INI_ALL | |
assert.callback | NULL | PHP_INI_ALL | |
assert.quiet_eval | "0" | PHP_INI_ALL | |
assert.exception | "0" | PHP_INI_ALL | 自 PHP 7.0.0 起有效。 |
enable_dl | "1" | PHP_INI_SYSTEM | 本过时特性将肯定会在未来被移除。 |
max_execution_time | "30" | PHP_INI_ALL | |
max_input_time | "-1" | PHP_INI_PERDIR | |
max_input_nesting_level | "64" | PHP_INI_PERDIR | 自 PHP 5.2.3 起有效。 |
max_input_vars | 1000 | PHP_INI_PERDIR | 自 PHP 5.3.9 起有效。 |
magic_quotes_gpc | "1" | PHP_INI_PERDIR | 在 PHP 5.4.0 中被移除。 |
magic_quotes_runtime | "0" | PHP_INI_ALL | 在 PHP 5.4.0 中移除 |
zend.enable_gc | "1" | PHP_INI_ALL | 自 PHP 5.3.0 起有效。 |
这是配置指令的简短说明。
-
assert.active
boolean -
激活 assert() 断言评测。
-
assert.bail
boolean -
失败的断言将中止脚本。
-
assert.warning
boolean -
为每个失败的断言产生一条 PHP 警告信息。
-
assert.callback
string -
断言失败后要调用的回调函数。
-
assert.quiet_eval
boolean -
在 断言表达式执行时 error_reporting() 使用当前的设置。 如果启用了,在执行时错误将不会被显示(隐式的 error_reporting(0))。 如果禁用了,错误将根据 error_reporting() 的设置来显示。
-
assert.exception
boolean -
在断言(assert)失败时产生 AssertionError 异常。
-
enable_dl
boolean -
该指令仅对 Apache 模块版本的 PHP 有效。 你可以针对每个虚拟机或每个目录开启或关闭 dl() 动态加载 PHP 模块。
关闭动态加载的主要原因是为了安全。通过动态加载,有可能忽略所有 open_basedir 限制。 默认允许动态加载。
-
max_execution_time
integer -
这设置了脚本被解析器中止之前允许的最大执行时间,单位秒。 这有助于防止写得不好的脚本占尽服务器资源。 默认设置为
30
。 从 命令行 运行 PHP 时,默认设置为0
。最大执行时间不会影响系统调用和系统操作等。更多细节参见 set_time_limit()。
你的 web 服务器也可以有其他超时设置,也有可能中断 PHP 的执行。 Apache 有一个
Timeout
指令,IIS 有一个 CGI 超时功能。 他们默认都是 300 秒。更多具体信息参见你的 web 服务器的文档。 -
max_input_time
integer -
脚本解析输入数据(类似 POST 和 GET)允许的最大时间,单位是秒。 它从接收所有数据到开始执行脚本进行测量的。默认设置为
-1
,意味着使用 max_execution_time 的值做为默认值,如果不想限制,请设置为0
。 -
max_input_nesting_level
integer -
max_input_vars
integer -
接受多少 输入的变量(限制分别应用于 $_GET、$_POST 和 $_COOKIE 超全局变量) 指令的使用减轻了以哈希碰撞来进行拒绝服务攻击的可能性。 如有超过指令指定数量的输入变量,将会导致
E_WARNING
的产生, 更多的输入变量将会从请求中截断。 -
magic_quotes_gpc
boolean -
警告
本特性已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。
为 GPC (Get/Post/Cookie) 操作设置 magic_quotes 状态。 当 magic_quotes 为 on,所有的 ' (单引号)、" (双引号)、\(反斜杠)和 NUL's 被一个反斜杠自动转义。
-
magic_quotes_runtime
boolean -
警告
本特性已自 PHP 5.3.0 起废弃并将自 PHP 5.4.0 起移除。
如果启用了
magic_quotes_runtime
,大多数返回任何形式外部数据的函数,包括数据库和文本段将会用反斜线转义引号。受
magic_quotes_runtime
影响的函数(不包括 PECL 里的函数):- get_meta_tags()
- file_get_contents()
- file()
- fgets()
- fwrite()
- fread()
- fputcsv()
- stream_socket_recvfrom()
- exec()
- system()
- passthru()
- stream_get_contents()
- bzread()
- gzfile()
- gzgets()
- gzwrite()
- gzread()
- exif_read_data()
- dba_insert()
- dba_replace()
- dba_fetch()
- ibase_fetch_row()
- ibase_fetch_assoc()
- ibase_fetch_object()
- mssql_fetch_row()
- mssql_fetch_object()
- mssql_fetch_array()
- mssql_fetch_assoc()
- mysqli_fetch_row()
- mysqli_fetch_array()
- mysqli_fetch_assoc()
- mysqli_fetch_object()
- pg_fetch_row()
- pg_fetch_assoc()
- pg_fetch_array()
- pg_fetch_object()
- pg_fetch_all()
- pg_select()
- sybase_fetch_object()
- sybase_fetch_array()
- sybase_fetch_assoc()
- SplFileObject::fgets()
- SplFileObject::fgetcsv()
- SplFileObject::fwrite()
-
zend.enable_gc
boolean -
启用或禁用循环引用记数搜集器。
