锟斤拷锟叫憋拷只锟斤拷锟斤拷锟斤拷锟侥碉拷 php.ini 锟斤拷锟斤拷选锟筋。锟斤拷展锟斤拷锟斤拷锟斤拷选锟斤拷锟节革拷锟斤拷锟斤拷展锟斤拷锟侥碉拷页锟斤拷直锟斤拷锟斤拷锟斤拷锟斤拷泄锟� session 锟斤拷选锟斤拷锟斤拷锟斤拷锟� sessions 页锟斤拷锟揭碉拷锟斤拷
Note:
The defaults listed here are used when php.ini is not loaded; the values for the production and development php.ini may vary.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
short_open_tag | "1" | PHP_INI_PERDIR | |
asp_tags | "0" | PHP_INI_PERDIR | PHP 7.0.0. 锟斤拷锟狡筹拷锟斤拷 |
precision | "14" | PHP_INI_ALL | |
serialize_precision | "17" | PHP_INI_ALL | 锟斤拷 PHP 5.3.5锟斤拷前锟斤拷默锟斤拷值为 100 |
y2k_compliance | "1" | PHP_INI_ALL | 锟斤拷 PHP 5.4.0 锟斤拷锟狡筹拷锟斤拷选锟筋。 |
allow_call_time_pass_reference | "1" | PHP_INI_PERDIR | 锟斤拷 PHP 5.4.0 锟斤拷锟狡筹拷锟斤拷选锟筋。 |
disable_functions | "" | 锟斤拷锟斤拷为 PHP_INI_SYSTEM | |
disable_classes | "" | 锟斤拷锟斤拷为 php.ini | |
exit_on_timeout | "" | PHP_INI_ALL | 锟斤拷 PHP 5.3.0 锟斤拷锟斤拷谩锟� |
expose_php | "1" | php.ini only | |
hard_timeout | "2" | PHP_INI_SYSTEM | PHP 7.1.0 锟斤拷锟斤拷锟� |
zend.multibyte | "0" | PHP_INI_ALL | 锟斤拷 PHP 5.4.0 锟斤拷锟斤拷锟� |
zend.script_encoding | NULL | PHP_INI_ALL | 锟斤拷 PHP 5.4.0 锟斤拷锟斤拷锟� |
zend.detect-unicode | NULL | PHP_INI_ALL | 锟斤拷 PHP 5.4.0 锟斤拷锟斤拷锟� |
zend.signal_check | "0" | PHP_INI_SYSTEM | 锟斤拷 PHP 5.4.0 锟斤拷锟斤拷锟� |
zend.assertions | "1" | PHP_INI_ALL | 锟斤拷 PHP 7.0.0 锟斤拷锟斤拷锟� |
zend.ze1_compatibility_mode | "0" | PHP_INI_ALL | 锟斤拷 PHP 5.3.0 锟斤拷锟狡筹拷锟斤拷选锟斤拷 |
detect_unicode | "1" | PHP_INI_ALL | 锟斤拷 PHP 5.1.0锟斤拷锟斤拷谩锟� PHP 5.4.0 锟斤拷锟斤拷锟斤拷锟斤拷为 zend.detect-unicode锟斤拷 |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
short_open_tag
boolean
锟斤拷锟斤拷锟角凤拷锟斤拷锟斤拷使锟斤拷 PHP 锟斤拷锟诫开始锟斤拷志锟斤拷锟斤拷写锟斤拷式锟斤拷<?
?>
锟斤拷锟斤拷锟斤拷锟揭拷锟� XML 锟斤拷锟绞癸拷锟�
PHP锟斤拷锟斤拷锟皆斤拷锟矫达拷选锟斤拷锟皆憋拷锟斤拷嵌锟斤拷使锟斤拷
<?xml ?>
锟斤拷锟斤拷锟津还匡拷锟斤拷通锟斤拷
PHP 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷纾�<?php echo '<?xml
version="1.0"'; ?>
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷耍锟斤拷锟斤拷锟绞癸拷锟�
PHP 锟斤拷锟诫开始锟斤拷志锟斤拷锟斤拷锟斤拷锟斤拷式锟斤拷<?php
?>
锟斤拷锟斤拷
Note:
锟斤拷指锟斤拷也锟斤拷影锟届到锟斤拷写锟斤拷式
<?=
锟斤拷锟斤拷锟斤拷<? echo
锟饺价★拷使锟矫达拷锟斤拷写锟斤拷要short_open_tag
锟斤拷值为 On锟斤拷 锟斤拷 PHP 5.4.0 锟斤拷<?=
锟斤拷锟角匡拷锟矫的★拷
锟芥本 | 说锟斤拷 |
---|---|
7.0.0 | 锟斤拷 PHP 锟斤拷锟狡筹拷锟斤拷 |
precision
integer
serialize_precision
integer
y2k_compliance
boolean
allow_call_time_pass_reference
boolean
锟节猴拷锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫达拷锟斤拷时锟角否发筹拷锟斤拷锟芥。锟剿凤拷锟斤拷锟窖诧拷锟斤拷锟睫成诧拷锟斤拷 PHP/Zend 未锟斤拷锟侥版本锟叫很匡拷锟杰诧拷锟斤拷支锟街★拷锟斤拷锟斤拷使锟矫的凤拷锟斤拷锟斤拷锟节猴拷锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷锟斤拷些锟斤拷锟斤拷应锟斤拷锟斤拷锟斤拷锟矫达拷锟捷★拷锟斤拷锟斤拷锟斤拷页锟斤拷怨乇沾锟窖★拷畈⑷凤拷锟斤拷疟锟斤拷芄锟斤拷锟斤拷锟斤拷锟斤拷校锟斤拷锟饺凤拷锟斤拷媒疟锟揭诧拷锟斤拷锟轿达拷锟斤拷陌姹撅拷锟斤拷锟斤拷校锟矫匡拷锟绞癸拷么锟斤拷锟斤拷远锟斤拷锟斤拷盏锟揭伙拷锟斤拷锟斤拷妫╋拷锟�
锟节猴拷锟斤拷锟斤拷锟斤拷时通锟斤拷锟斤拷锟矫达拷锟捷诧拷锟斤拷锟角诧拷锟狡硷拷锟侥o拷锟斤拷为锟斤拷影锟届到锟剿达拷锟斤拷锟斤拷锟斤拷唷o拷锟斤拷锟斤拷锟斤拷锟侥诧拷锟斤拷没锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷锟矫达拷锟捷o拷锟斤拷锟斤拷锟斤拷锟斤拷通锟斤拷未写锟斤拷锟侥碉拷锟侥凤拷锟斤拷锟睫革拷锟斤拷锟斤拷锟斤拷锟揭拷锟斤拷锟斤拷涓憋拷锟斤拷茫锟斤拷锟矫斤拷锟节猴拷锟斤拷锟斤拷锟斤拷时指锟斤拷锟角革拷锟斤拷锟斤拷锟斤拷要通锟斤拷锟斤拷锟矫达拷锟捷★拷
锟轿硷拷锟斤拷锟矫的斤拷锟斤拷锟斤拷
锟芥本 | 说锟斤拷 |
---|---|
5.4.0 | 锟斤拷 PHP 锟斤拷锟狡筹拷锟斤拷 |
5.3.0 |
Emits an E_DEPRECATED level error.
|
5.0.0 |
Deprecated, and generates an E_COMPILE_WARNING level error.
|
expose_php
boolean
锟斤拷锟斤拷锟角凤拷露 PHP 锟斤拷锟斤拷装锟节凤拷锟斤拷锟斤拷锟较o拷锟斤拷锟斤拷锟斤拷 Web 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息头锟叫硷拷锟斤拷锟斤拷签锟斤拷锟斤拷X-Powered-By: PHP/5.3.7)锟斤拷 The PHP logo guids are also exposed, thus appending them to the URL of a PHP enabled site will display the appropriate logo (e.g., » https://www.php.net/?=PHPE9568F34-D428-11d2-A769-00AA001ACF42). This also affects the output of phpinfo(), as when disabled, the PHP logo and credits information will not be displayed.
Note:
Since PHP 5.5.0 these guids and the php_logo_guid() function have been removed from PHP and the guids are replaced with data URIs instead. Thus accessing the PHP logo via appending the guid to the URL no longer works. Similarly, turning
expose_php
off will not affect seeing the PHP logo in phpinfo().
See also php_logo_guid() and phpcredits().
disable_functions
string
锟斤拷指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�锟斤拷全原锟斤拷锟街鼓承╋拷锟斤拷锟斤拷锟斤拷锟斤拷芏锟斤拷欧指锟斤拷暮锟斤拷锟斤拷锟斤拷斜锟斤拷锟轿拷锟斤拷锟斤拷锟� disable_functions 锟斤拷锟斤拷锟斤拷全模式锟斤拷影锟届。
Only internal functions can be disabled using this directive. User-defined functions are unaffected.
锟斤拷指锟斤拷只锟斤拷锟斤拷锟斤拷锟斤拷 php.ini 锟叫★拷锟斤拷锟界不锟杰斤拷锟斤拷锟斤拷锟斤拷锟斤拷 httpd.conf锟斤拷
disable_classes
string
zend.assertions
integer
Note:
If a process is started in production mode, zend.assertions cannot be changed at runtime, since the code for assertions was not generated.
If a process is started in development mode, zend.assertions cannot be set to -1 at runtime.
zend.ze1_compatibility_mode
boolean
Enable compatibility mode with Zend Engine 1 (PHP 4). It affects
the cloning, casting (objects with no properties cast to FALSE
or 0), and comparing of objects.
In this mode, objects are passed by value instead of reference by
default.
See also the section titled Migrating from PHP 4 to PHP 5.
This feature has been DEPRECATED and REMOVED as of PHP 5.3.0.
hard_timeout
integer
zend.multibyte
boolean
Enables parsing of source files in multibyte encodings. Enabling zend.multibyte is required to use character encodings like SJIS, BIG5, etc that contain special characters in multibyte string data. ISO-8859-1 compatible encodings like UTF-8, EUC, etc do not require this option.
Enabling zend.multibyte requires the mbstring extension to be available.
zend.script_encoding
string
This value will be used unless a declare(encoding=...) directive appears at the top of the script. When ISO-8859-1 incompatible encoding is used, both zend.multibyte and zend.script_encoding must be used.
Literal strings will be transliterated from zend.script_enconding to mbstring.internal_encoding, as if mb_convert_encoding() would have been called.
zend.detect_unicode
boolean
Check for BOM (Byte Order Mark) and see if the file contains valid multibyte characters. This detection is performed before processing of __halt_compiler(). Available only in Zend Multibyte mode.
zend.signal_check
boolean
To check for replaced signal handlers on shutdown.
exit_on_timeout
boolean
This is an Apache1 mod_php-only directive that forces an Apache child to exit if a PHP execution timeout occurred. Such a timeout causes an internal longjmp() call in Apache1 which can leave some extensions in an inconsistent state. By terminating the process any outstanding locks or memory will be cleaned up.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
memory_limit | "128M" | PHP_INI_ALL | "8M" before PHP 5.2.0, "16M" in PHP 5.2.0 |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
memory_limit
integer
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using --enable-memory-limit in the configure line. This compile-time flag was also required to define the functions memory_get_usage() and memory_get_peak_usage() prior to 5.2.1.
锟斤拷使锟斤拷 integer 时, 锟斤拷值锟斤拷锟街斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷使锟斤拷锟斤拷FAQ锟斤拷锟斤拷锟斤拷锟斤拷锟劫记凤拷锟斤拷See also: max_execution_time.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
realpath_cache_size | "4M" | PHP_INI_SYSTEM | Available since PHP 5.1.0. Prior to PHP 7.0.16 and 7.1.2, the default was "16K" |
realpath_cache_ttl | "120" | PHP_INI_SYSTEM | Available since PHP 5.1.0. |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
realpath_cache_size
integer
Determines the size of the realpath cache to be used by PHP. This value should be increased on systems where PHP opens many files, to reflect the quantity of the file operations performed.
The size represents the total number of bytes in the path strings stored, plus the size of the data associated with the cache entry. This means that in order to store longer paths in the cache, the cache size must be larger. This value does not directly control the number of distinct paths that can be cached.
The size required for the cache entry data is system dependent.
realpath_cache_ttl
integer
Duration of time (in seconds) for which to cache realpath information for a given file or directory. For systems with rarely changing files, consider increasing the value.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
arg_separator.output | "&" | PHP_INI_ALL | |
arg_separator.input | "&" | PHP_INI_PERDIR | |
variables_order | "EGPCS" | PHP_INI_PERDIR | PHP_INI_ALL in PHP <= 5.0.5. |
request_order | "" | PHP_INI_PERDIR | Available since PHP 5.3.0 |
auto_globals_jit | "1" | PHP_INI_PERDIR | Available since PHP 5.0.0. |
register_globals | "0" | PHP_INI_PERDIR | Removed in PHP 5.4.0. |
register_argc_argv | "1" | PHP_INI_PERDIR | |
register_long_arrays | "1" | PHP_INI_PERDIR | Deprecated in PHP 5.3.0. Removed in PHP 5.4.0. |
enable_post_data_reading | "1" | PHP_INI_PERDIR | Available since PHP 5.4.0 |
post_max_size | "8M" | PHP_INI_PERDIR | |
auto_prepend_file | NULL | PHP_INI_PERDIR | |
auto_append_file | NULL | PHP_INI_PERDIR | |
default_mimetype | "text/html" | PHP_INI_ALL | |
default_charset | "UTF-8" | PHP_INI_ALL | Defaults to "UTF-8" since PHP >= 5.6.0; empty for PHP < 5.6.0. |
always_populate_raw_post_data | "0" | PHP_INI_PERDIR | Removed in PHP 7.0.0. |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
arg_separator.output
string
The separator used in PHP generated URLs to separate arguments.
arg_separator.input
string
List of separator(s) used by PHP to parse input URLs into variables.
Note:
Every character in this directive is considered as separator!
variables_order
string
Sets the order of the EGPCS (Environment, Get, Post, Cookie, and Server) variable parsing. For example, if variables_order is set to "SP" then PHP will create the superglobals $_SERVER and $_POST, but not create $_ENV, $_GET, and $_COOKIE. Setting to "" means no superglobals will be set.
If the deprecated register_globals directive is on, then variables_order also configures the order the ENV, GET, POST, COOKIE and SERVER variables are populated in global scope. So for example if variables_order is set to "EGPCS", register_globals is enabled, and both $_GET['action'] and $_POST['action'] are set, then $action will contain the value of $_POST['action'] as P comes after G in our example directive value.
In both the CGI and FastCGI SAPIs, $_SERVER is also populated by values from the environment; S is always equivalent to ES regardless of the placement of E elsewhere in this directive.
Note:
The content and order of $_REQUEST is also affected by this directive.
request_order
string
This directive describes the order in which PHP registers GET, POST and Cookie variables into the _REQUEST array. Registration is done from left to right, newer values override older values.
If this directive is not set, variables_order is used for $_REQUEST contents.
Note that the default distribution php.ini files does not contain the 'C' for cookies, due to security concerns.
auto_globals_jit
boolean
When enabled, the SERVER, REQUEST, and ENV variables are created when they're first used (Just In Time) instead of when the script starts. If these variables are not used within a script, having this directive on will result in a performance gain.
The PHP directives register_globals, register_long_arrays, and register_argc_argv must be disabled for this directive to have any affect. Since PHP 5.1.3 it is not necessary to have register_argc_argv disabled.
Usage of SERVER, REQUEST, and ENV variables is checked during the compile time so using them through e.g. variable variables will not cause their initialization.
register_globals
boolean
Whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables.
As of » PHP 4.2.0, this directive defaults to off.
Please read the security chapter on Using register_globals for related information.
Please note that register_globals
cannot be set at runtime (ini_set()). Although, you can
use .htaccess if your host allows it as described
above. An example .htaccess entry:
php_flag register_globals off
.
Note:
register_globals
is affected by the variables_order directive.
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 PHP 5.3.0 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 PHP 5.4.0 锟斤拷锟狡筹拷锟斤拷
register_argc_argv
boolean
register_long_arrays
boolean
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 PHP 5.3.0 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 PHP 5.4.0 锟斤拷锟狡筹拷锟斤拷
enable_post_data_reading
boolean
post_max_size
integer
post_max_size
.
锟斤拷使锟斤拷 integer
时, 锟斤拷值锟斤拷锟街斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷使锟斤拷锟斤拷FAQ锟斤拷锟斤拷锟斤拷锟斤拷锟劫记凤拷锟斤拷
If the size of post data is greater than post_max_size, the
$_POST and $_FILES
superglobals
are empty. This can be tracked in various ways, e.g. by passing the
$_GET variable to the script processing the data,
i.e. <form action="edit.php?processed=1">,
and then checking if $_GET['processed'] is set.
Note:
PHP allows shortcuts for byte values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you're using 32bit versions) as it will cause your script to fail.
锟芥本 | 说锟斤拷 |
---|---|
5.3.4 |
post_max_size = 0 will not disable the limit when the content
type is application/x-www-form-urlencoded or is not registered with PHP.
|
5.3.2 , 5.2.12 |
Allow unlimited post size by setting post_max_size to 0.
|
auto_prepend_file
string
Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require function, so include_path is used.
The special value none disables auto-prepending.
auto_append_file
string
Specifies the name of a file that is automatically parsed after the main file. The file is included as if it was called with the require function, so include_path is used.
The special value none disables auto-appending.
Note: If the script is terminated with exit(), auto-append will not occur.
default_mimetype
string
By default, PHP will output a media type using the Content-Type header. To disable this, simply set it to be empty.
PHP's built-in default media type is set to text/html.
default_charset
string
In PHP 5.6 onwards, "UTF-8" is the default value and its value is used
as the default character encoding for
htmlentities(),
html_entity_decode() and
htmlspecialchars() if the
encoding
parameter is omitted. The value of
default_charset
will also be used to set the
default character set for iconv
functions if the
iconv.input_encoding
,
iconv.output_encoding
and
iconv.internal_encoding
configuration options are unset, and for
mbstring functions if the
mbstring.http_input
mbstring.http_output
mbstring.internal_encoding
configuration option is unset.
All versions of PHP will use this value as the charset within the default Content-Type header sent by PHP if the header isn't overridden by a call to header().
Setting default_charset
to an empty value is
not recommended.
input_encoding
string
Available from PHP 5.6.0. This setting is used for multibyte modules such as mbstring and iconv. Default is empty.
output_encoding
string
Available from PHP 5.6.0. This setting is used for multibyte modules such as mbstring and iconv. Default is empty.
internal_encoding
string
Available from PHP 5.6.0. This setting is used for multibyte modules such as mbstring and iconv. Default is empty. If empty, default_charset is used.
always_populate_raw_post_data
mixed
This feature was DEPRECATED in PHP 5.6.0, and REMOVED as of PHP 7.0.0.
If set to TRUE
, PHP will always populate the
$HTTP_RAW_POST_DATA containing the raw POST data.
Otherwise, the variable is populated only when the MIME type of the
data is unrecognised.
The preferred method for accessing raw POST data is
php://input, and
$HTTP_RAW_POST_DATA is deprecated in PHP 5.6.0
onwards. Setting always_populate_raw_post_data
to -1 will opt into the new behaviour that will be
implemented in a future version of PHP, in which
$HTTP_RAW_POST_DATA is never defined.
Regardless of the setting, $HTTP_RAW_POST_DATA is not available with enctype="multipart/form-data".
See also: magic_quotes_gpc, magic_quotes_runtime, and magic_quotes_sybase.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
include_path | ".;/path/to/php/pear" | PHP_INI_ALL | |
open_basedir | NULL | PHP_INI_ALL | PHP_INI_SYSTEM in PHP < 5.3.0 |
doc_root | NULL | PHP_INI_SYSTEM | |
user_dir | NULL | PHP_INI_SYSTEM | |
user_ini.cache_ttl | "300" | PHP_INI_SYSTEM | Available since PHP 5.3.0. |
user_ini.filename | ".user.ini" | PHP_INI_SYSTEM | Available since PHP 5.3.0. |
extension_dir | "/path/to/php" | PHP_INI_SYSTEM | |
extension | NULL | php.ini only | |
zend_extension | NULL | php.ini only | |
zend_extension_debug | NULL | php.ini only | Available before PHP 5.3.0. |
zend_extension_debug_ts | NULL | php.ini only | Available before PHP 5.3.0. |
zend_extension_ts | NULL | php.ini only | Available before PHP 5.3.0. |
cgi.check_shebang_line | "1" | PHP_INI_SYSTEM | Available since PHP 5.2.0. |
cgi.discard_path | "0" | PHP_INI_SYSTEM | Available since PHP 5.3.0. |
cgi.fix_pathinfo | "1" | PHP_INI_SYSTEM | PHP_INI_ALL prior to PHP 5.2.1. |
cgi.force_redirect | "1" | PHP_INI_SYSTEM | PHP_INI_ALL prior to PHP 5.2.1. |
cgi.nph | "0" | PHP_INI_SYSTEM | Available since PHP 5.3.0. |
cgi.redirect_status_env | NULL | PHP_INI_SYSTEM | PHP_INI_ALL prior to PHP 5.2.1. |
cgi.rfc2616_headers | "0" | PHP_INI_ALL | |
fastcgi.impersonate | "0" | PHP_INI_SYSTEM | PHP_INI_ALL prior to PHP 5.2.1. |
fastcgi.logging | "1" | PHP_INI_SYSTEM | PHP_INI_ALL prior to PHP 5.2.1. |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
include_path
string
Specifies a list of directories where the require, include, fopen(), file(), readfile() and file_get_contents() functions look for files. The format is like the system's PATH environment variable: a list of directories separated with a colon in Unix or semicolon in Windows.
PHP considers each entry in the include path separately when looking for files to include. It will check the first path, and if it doesn't find it, check the next path, until it either locates the included file or returns with a warning or an error. You may modify or set your include path at runtime using set_include_path().
Example #1 Unix include_path
include_path=".:/php/includes"
Example #2 Windows include_path
include_path=".;c:\php\includes"
Using a . in the include path allows for relative includes as it means the current directory. However, it is more efficient to explicitly use include './file' than having PHP always check the current directory for every include.
Note:
ENV variables are also accessible in .ini files. As such it is possible to reference the home directory using ${LOGIN} and ${USER}.
Environment variables may vary between Server APIs as those environments may be different.
Example #3 Unix include_path using ${USER} env variable
include_path = ".:${USER}/pear/php"
open_basedir
string
Limit the files that can be accessed by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.
When a script tries to access the filesystem, for example using include, or fopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to access it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink. If the file doesn't exist then the symlink couldn't be resolved and the filename is compared to (a resolved) open_basedir .
open_basedir can affect more than just filesystem functions; for example if MySQL is configured to use mysqlnd drivers, LOAD DATA INFILE will be affected by open_basedir . Much of the extended functionality of PHP uses open_basedir in this way.
The special value .
indicates that the working directory of the script will be used as the
base-directory. This is, however, a little dangerous as the working directory
of the script can easily be changed with chdir().
In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none".
Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.
The restriction specified with open_basedir is a directory name since PHP 5.2.16 and 5.3.4. Previous versions used it as a prefix. This means that "open_basedir = /dir/incl" also allowed access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: open_basedir = /dir/incl/
The default is to allow all files to be opened.
Note:
As of PHP 5.3.0 open_basedir can be tightened at run-time. This means that if open_basedir is set to /www/ in php.ini a script can tighten the configuration to /www/tmp/ at run-time with ini_set(). When listing several directories, you can use the
PATH_SEPARATOR
constant as a separator regardless of the operating system.
doc_root
string
PHP's "root directory" on the server. Only used if non-empty. If PHP is configured with 锟斤拷全模式, no files outside this directory are served. If PHP was not compiled with FORCE_REDIRECT, you should set doc_root if you are running PHP as a CGI under any web server (other than IIS). The alternative is to use the cgi.force_redirect configuration below.
user_ini.cache_ttl
integer
user_ini.filename
string
user_dir
string
The base name of the directory used on a user's home directory for PHP files, for example public_html .
extension_dir
string
In what directory PHP should look for dynamically loadable extensions. See also: enable_dl, and dl().
extension
string
Which dynamically loadable extensions to load when PHP starts up.
zend_extension
string
Name of dynamically loadable Zend extension (for example APD) to load when PHP starts up.
zend_extension_debug
string
Variant of zend_extension for extensions compiled with debug info prior to PHP 5.3.0.
zend_extension_debug_ts
string
Variant of zend_extension for extensions compiled with debug info and thread safety prior to PHP 5.3.0.
zend_extension_ts
string
Variant of zend_extension for extensions compiled with thread safety prior to PHP 5.3.0.
cgi.check_shebang_line
boolean
Controls whether CGI PHP checks for line starting with #! (shebang) at the top of the running script. This line might be needed if the script support running both as stand-alone script and via PHP CGI. PHP in CGI mode skips this line and ignores its content if this directive is turned on.
cgi.discard_path
boolean
If this is enabled, the PHP CGI binary can safely be placed outside of the web tree and people will not be able to circumvent .htaccess security.
cgi.fix_pathinfo
boolean
Provides real PATH_INFO/ PATH_TRANSLATED support for CGI. PHP's previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok what PATH_INFO is. For more information on PATH_INFO, see the CGI specs. Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting of zero causes PHP to behave as before. It is turned on by default. You should fix your scripts to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
cgi.force_redirect
boolean
cgi.force_redirect is necessary to provide security running PHP as a CGI under most web servers. Left undefined, PHP turns this on by default. You can turn it off at your own risk.
Note:
Windows Users: When using IIS this option must be turned off. For OmniHTTPD or Xitami the same applies.
cgi.nph
boolean
If cgi.nph is enabled it will force cgi to always sent Status: 200 with every request.
cgi.redirect_status_env
string
If cgi.force_redirect is turned on, and you are not running under Apache or Netscape (iPlanet) web servers, you may need to set an environment variable name that PHP will look for to know it is OK to continue execution.
Note:
Setting this variable may cause security issues, know what you are doing first.
cgi.rfc2616_headers
int
Tells PHP what type of headers to use when sending HTTP response code. If it's set to 0, PHP sends a » RFC 3875 "Status:" header that is supported by Apache and other web servers. When this option is set to 1, PHP will send » RFC 2616 compliant headers.
If this option is enabled, and you are running PHP in a CGI environment (e.g. PHP-FPM) you should not use standard RFC 2616 style HTTP status response headers, you should instead use their RFC 3875 equivalent e.g. instead of header("HTTP/1.0 404 Not found"); you should use header("Status: 404 Not Found");
Leave it set to 0 unless you know what you're doing.
fastcgi.impersonate
string
FastCGI under IIS (on WINNT based OS) supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under. mod_fastcgi under Apache does not currently support this feature (03/17/2002) Set to 1 if running under IIS. Default is zero.
fastcgi.logging
boolean
Turns on SAPI logging when using FastCGI. Default is to enable logging.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
file_uploads | "1" | PHP_INI_SYSTEM | |
upload_tmp_dir | NULL | PHP_INI_SYSTEM | |
max_input_nesting_level | 64 | PHP_INI_PERDIR | Available since PHP 5.3.9. |
max_input_vars | 1000 | PHP_INI_PERDIR | Available since PHP 5.3.9. |
upload_max_filesize | "2M" | PHP_INI_PERDIR | |
max_file_uploads | 20 | PHP_INI_SYSTEM | Available since PHP 5.2.12. |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
file_uploads
boolean
Whether or not to allow HTTP file uploads. See also the upload_max_filesize, upload_tmp_dir, and post_max_size directives.
upload_tmp_dir
string
The temporary directory used for storing files when doing file upload. Must be writable by whatever user PHP is running as. If not specified PHP will use the system's default.
If the directory specified here is not writable, PHP falls back to the system default temporary directory. If open_basedir is on, then the system default directory must be allowed for an upload to succeed.
upload_max_filesize
integer
The maximum size of an uploaded file.
锟斤拷使锟斤拷 integer 时, 锟斤拷值锟斤拷锟街斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷使锟斤拷锟斤拷FAQ锟斤拷锟斤拷锟斤拷锟斤拷锟劫记凤拷锟斤拷max_file_uploads
integer
The maximum number of files allowed to be uploaded simultaneously. Starting with PHP 5.3.4, upload fields left blank on submission do not count towards this limit.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
sql.safe_mode | "0" | PHP_INI_SYSTEM | Removed in PHP 7.2.0 |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
sql.safe_mode
boolean
If turned on, database connection functions that specify default values will use those values in place of any user-supplied arguments. For details on the default values, see the documentation for the relevant connection functions.
This feature has been REMOVED as of PHP 7.2.0.
锟斤拷锟斤拷 | 默锟斤拷 | 锟斤拷锟睫改凤拷围 | 锟斤拷锟斤拷锟斤拷志 |
---|---|---|---|
windows.show_crt_warning | "0" | PHP_INI_ALL | Available since PHP 5.4.0. |
锟斤拷锟斤拷锟斤拷锟斤拷指锟斤拷募锟斤拷说锟斤拷锟斤拷
windows.show_crt_warning
boolean
This directive shows the Windows CRT warnings when enabled. These warnings were displayed by default until PHP 5.4.0.