這些函數(shù)的行為受 php.ini 中的設(shè)置影響。
名字 | 默認 | 可修改范圍 | 更新日志 |
---|---|---|---|
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
為每個失敗的斷言產(chǎn)生一條 PHP 警告信息。
assert.callback
string
斷言失敗后要調(diào)用的回調(diào)函數(shù)。
assert.quiet_eval
boolean
在 斷言表達式執(zhí)行時 error_reporting() 使用當前的設(shè)置。 如果啟用了,在執(zhí)行時錯誤將不會被顯示(隱式的 error_reporting(0))。 如果禁用了,錯誤將根據(jù) error_reporting() 的設(shè)置來顯示。
assert.exception
boolean
在斷言(assert)失敗時產(chǎn)生 AssertionError 異常。
enable_dl
boolean
該指令僅對 Apache 模塊版本的 PHP 有效。 你可以針對每個虛擬機或每個目錄開啟或關(guān)閉 dl() 動態(tài)加載 PHP 模塊。
關(guān)閉動態(tài)加載的主要原因是為了安全。通過動態(tài)加載,有可能忽略所有 open_basedir 限制。 默認允許動態(tài)加載。
max_execution_time
integer
這設(shè)置了腳本被解析器中止之前允許的最大執(zhí)行時間,單位秒。
這有助于防止寫得不好的腳本占盡服務(wù)器資源。
默認設(shè)置為 30
。
從 命令行 運行 PHP 時,默認設(shè)置為 0
。
最大執(zhí)行時間不會影響系統(tǒng)調(diào)用和系統(tǒng)操作等。更多細節(jié)參見 set_time_limit()。
你的 web 服務(wù)器也可以有其他超時設(shè)置,也有可能中斷 PHP 的執(zhí)行。
Apache 有一個
Timeout
指令,IIS 有一個 CGI 超時功能。
他們默認都是 300 秒。更多具體信息參見你的 web 服務(wù)器的文檔。
max_input_time
integer
腳本解析輸入數(shù)據(jù)(類似 POST 和 GET)允許的最大時間,單位是秒。
它從接收所有數(shù)據(jù)到開始執(zhí)行腳本進行測量的。默認設(shè)置為
-1
,意味著使用
max_execution_time
的值做為默認值,如果不想限制,請設(shè)置為 0
。
max_input_nesting_level
integer
max_input_vars
integer
接受多少 輸入的變量(限制分別應(yīng)用于 $_GET、$_POST 和 $_COOKIE 超全局變量)
指令的使用減輕了以哈希碰撞來進行拒絕服務(wù)攻擊的可能性。
如有超過指令指定數(shù)量的輸入變量,將會導致 E_WARNING
的產(chǎn)生,
更多的輸入變量將會從請求中截斷。
magic_quotes_gpc
boolean
本特性已自 PHP 5.3.0 起廢棄并將自 PHP 5.4.0 起移除。
為 GPC (Get/Post/Cookie) 操作設(shè)置 magic_quotes 狀態(tài)。 當 magic_quotes 為 on,所有的 ' (單引號)、" (雙引號)、\(反斜杠)和 NUL's 被一個反斜杠自動轉(zhuǎn)義。
magic_quotes_runtime
boolean
本特性已自 PHP 5.3.0 起廢棄并將自 PHP 5.4.0 起移除。
如果啟用了 magic_quotes_runtime
,大多數(shù)返回任何形式外部數(shù)據(jù)的函數(shù),包括數(shù)據(jù)庫和文本段將會用反斜線轉(zhuǎn)義引號。
受 magic_quotes_runtime
影響的函數(shù)(不包括 PECL 里的函數(shù)):
zend.enable_gc
boolean
啟用或禁用循環(huán)引用記數(shù)搜集器。