该列表只包含核心的 php.ini 配置选项。扩展的配置选项在各个扩展的文档页面分别被描述。有关 session 的选项可以在 sessions 页面找到。
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
async_send | "0" | PHP_INI_ALL |
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
short_open_tag | "1" | PHP_INI_ALL | 在 PHP 4.0.0 时是 PHP_INI_ALL。 在 PHP < 5.3.0 时是 PHP_INI_PERDIR。 |
asp_tags | "0" | PHP_INI_PERDIR | 在 PHP 4.0.0 时是 PHP_INI_ALL。 |
precision | "14" | PHP_INI_ALL | |
serialize_precision | "17" | PHP_INI_ALL | 从 PHP 4.3.2 起可用。在 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 4.0.0 时是 PHP_INI_ALL。 在 PHP 5.4.0 中移除该选项。 |
disable_functions | "" | php.ini only | 从 PHP 4.0.1 起可用。 |
disable_classes | "" | php.ini only | 从 PHP 4.3.2 起可用。 |
exit_on_timeout | "" | PHP_INI_ALL | 从 PHP 5.3.0 起可用。 |
expose_php | "1" | php.ini only | |
zend.multibyte | "0" | PHP_INI_ALL | 从 PHP 5.4.0 起可用 |
zend.script_encoding | NULL | PHP_INI_ALL | 从 PHP 5.4.0 起可用 |
zend.signal_check | "0" | PHP_INI_SYSTEM | 从 PHP 5.4.0 起可用 |
zend.ze1_compatibility_mode | "0" | PHP_INI_ALL | 从 PHP 5.0.0起可用。 在 PHP 5.3.0 中移除该选项 |
detect_unicode | "1" | PHP_INI_ALL | 从 PHP 5.1.0起可用。 本过时特性将肯定会在未来被移除。 |
这是配置指令的简短说明。
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 起,<?=
总是可用的。
precision
integer
serialize_precision
integer
y2k_compliance
boolean
allow_call_time_pass_reference
boolean
在函数调用时参数被按照引用传递时是否发出警告。此方法已不被赞成并在 PHP/Zend 未来的版本中很可能不再支持。鼓励使用的方法是在函数定义中指定哪些参数应该用引用传递。鼓励大家尝试关闭此选项并确保脚本能够正常运行,以确保该脚本也能在未来的版本中运行(每次使用此特性都会收到一条警告)。
在函数调用时通过引用传递参数是不推荐的,因为它影响到了代码的整洁。如果函数的参数没有声明作为引用传递,函数可以通过未写入文档的方法修改其参数。要避免其副作用,最好仅在函数声明时指定那个参数需要通过引用传递。
参见引用的解释。
版本 | 说明 |
---|---|
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 被安装在服务器上(例如在 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., » http://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.
See also php_logo_guid() and phpcredits().
disable_functions
string
disable_classes
string
Note: 可用性说明
本指令自 PHP 4.3.2 起可用。
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.
zend.multibyte
boolean
Enables parsing of source files in multibyte encodings.
zend.script_encoding
string
This value will be used unless a declare(encoding=...) directive appears at the top of the script.
zend.signal_check
boolean
To check for replaced signal handlers on shutdown.
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.
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 | "16K" | PHP_INI_SYSTEM | 从 PHP 5.1.0 起可用。 |
realpath_cache_ttl | "120" | PHP_INI_SYSTEM | 从 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.
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.
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
track_vars | "On" | PHP_INI_?? | |
arg_separator.output | "&" | PHP_INI_ALL | 从 PHP 4.0.5 起可用。 |
arg_separator.input | "&" | PHP_INI_PERDIR | 从 PHP 4.0.5 起可用。 |
variables_order | "EGPCS" | PHP_INI_PERDIR | 在 PHP <= 5.0.5 时是 PHP_INI_ALL。 |
request_order | "" | PHP_INI_PERDIR | 从 PHP 5.3.0 起可用 |
auto_globals_jit | "1" | PHP_INI_PERDIR | 从 PHP 5.0.0 起可用。 |
register_globals | "0" | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 在 PHP 5.4.0 中移除该选项。 |
register_argc_argv | "1" | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 |
register_long_arrays | "1" | PHP_INI_PERDIR | 从 PHP 5.0.0. Deprecated in PHP 5.3.0. Removed in PHP 5.4.0 起可用。 |
post_max_size | "8M" | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_SYSTEM。 从 PHP 4.0.3 起可用。 |
gpc_order | "GPC" | PHP_INI_ALL | |
auto_prepend_file | NULL | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 |
auto_append_file | NULL | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 |
default_mimetype | "text/html" | PHP_INI_ALL | |
default_charset | "" | PHP_INI_ALL | |
always_populate_raw_post_data | "0" | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 从 PHP 4.1.0 起可用。 |
allow_webdav_methods | "0" | PHP_INI_PERDIR |
这是配置指令的简短说明。
track_vars
boolean
If enabled, then Environment, GET, POST, Cookie, and Server variables can be found in the global associative arrays $_ENV, $_GET, $_POST, $_COOKIE, and $_SERVER.
Note that as of PHP 4.0.3, track_vars
is always turned on.
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 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 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 bit 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.
gpc_order
string
Set the order of GET/POST/COOKIE variable parsing. The default setting of this directive is "GPC". Setting this to "GP", for example, will cause PHP to completely ignore cookies and to overwrite any GET method variables with POST-method variables of the same name.
Note:
This option is not available in PHP 4. Use variables_order instead.
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
default_charset
string
PHP always outputs a character encoding by default in the Content-type: header. To disable sending of the charset, simply set it to be empty.
always_populate_raw_post_data
boolean
Always populate the $HTTP_RAW_POST_DATA containing the raw POST data. Otherwise, the variable is populated only with unrecognized MIME type of the data. However, the preferred method for accessing the raw POST data is php://input. $HTTP_RAW_POST_DATA is not available with enctype="multipart/form-data".
allow_webdav_methods
boolean
Allow handling of WebDAV http requests within PHP scripts (eg. PROPFIND, PROPPATCH, MOVE, COPY, etc.). This directive does not exist as of PHP 4.3.2. If you want to get the post data of those requests, you have to set always_populate_raw_post_data as well.
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 | |
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 | |
zend_extension_debug_ts | NULL | php.ini only | |
zend_extension_ts | NULL | php.ini only | |
cgi.check_shebang_line | "1" | PHP_INI_SYSTEM | 从 PHP 5.2.0 起可用。 |
cgi.fix_pathinfo | "1" | PHP_INI_SYSTEM | 从 PHP 4.3.0. PHP_INI_ALL prior to PHP 5.2.1 起可用。 |
cgi.force_redirect | "1" | PHP_INI_SYSTEM | 从 PHP 4.2.0. PHP_INI_ALL prior to PHP 5.2.1 起可用。 |
cgi.redirect_status_env | NULL | PHP_INI_SYSTEM | 从 PHP 4.2.0. PHP_INI_ALL prior to PHP 5.2.1 起可用。 |
cgi.rfc2616_headers | "0" | PHP_INI_ALL | 从 PHP 4.3.0 起可用。 |
fastcgi.impersonate | "0" | PHP_INI_SYSTEM | 从 PHP 4.3.0. PHP_INI_ALL prior to PHP 5.2.1 起可用。 |
fastcgi.logging | "1" | PHP_INI_SYSTEM | 从 PHP 4.3.0. 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.
open_basedir
string
将 PHP 所能打开的文件限制在指定的目录树,包括文件本身。本指令不受安全模式打开或者关闭的影响。
当一个脚本试图用例如 fopen() 或者 gzopen() 打开一个文件时,该文件的位置将被检查。当文件在指定的目录树之外时 PHP 将拒绝打开它。所有的符号连接都会被解析,所以不可能通过符号连接来避开此限制。
特殊值 .
指明脚本的工作目录将被作为基准目录。但这有些危险,因为脚本的工作目录可以轻易被
chdir() 而改变。
在 httpd.conf 文件中中,open_basedir 可以像其它任何配置选项一样用“php_admin_value open_basedir none”的方法关闭(例如某些虚拟主机中)。
在 Windows 中,用分号分隔目录。在任何其它系统中用冒号分隔目录。作为 Apache 模块时,父目录中的 open_basedir 路径自动被继承。
用 open_basedir 指定的限制实际上是前缀,不是目录名。也就是说“open_basedir = /dir/incl”也会允许访问“/dir/include”和“/dir/incls”,如果它们存在的话。如果要将访问限制在仅为指定的目录,用斜线结束路径名。例如:“open_basedir = /dir/incl/”。
Note:
支持多个目录是 3.0.7 加入的。
默认是允许打开所有文件。
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_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
Absolute path to 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.
zend_extension_debug_ts
string
Variant of zend_extension for extensions compiled with debug info and thread safety.
zend_extension_ts
string
Variant of zend_extension for extensions compiled with thread safety.
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.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.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 0, PHP sends a 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. 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 | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 从 PHP 4.0.3 起可用。 |
upload_tmp_dir | NULL | PHP_INI_SYSTEM | |
max_input_nesting_level | 64 | PHP_INI_PERDIR | 从 PHP 5.3.9 起可用。 |
max_input_vars | 1000 | PHP_INI_PERDIR | 从 PHP 5.3.9 起可用。 |
upload_max_filesize | "2M" | PHP_INI_PERDIR | 在 PHP <= 4.2.3 时是 PHP_INI_ALL。 |
max_file_uploads | 20 | PHP_INI_SYSTEM | 从 PHP 5.2.12 起可用。 |
这是配置指令的简短说明。
file_uploads
boolean
or integer
Whether or not to allow HTTP file uploads. See also the upload_max_filesize, upload_tmp_dir, and post_max_size directives.
当使用 integer 时, 其值以字节来衡量。还可以使用在FAQ中描述的速记符。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 |
这是配置指令的简短说明。
sql.safe_mode
boolean
If turned on, database connect functions that specify default values will use those values in place of supplied arguments. For default values see connect function documentation for the relevant database.
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
windows_show_crt_warning | "0" | PHP_INI_ALL | 从 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.
peterdow at talk21 dot com (2013-06-26 00:04:50)
My webpage just failed and it looks like you changed php to stop my webpage working.
There's no worse crime in computer science than failing to respect backwards compatibility.
This sucks, big time.
It looks like you've trashed $HTTP_GET_VARS.
It seems to be traced backed to
register_long_arrays "1" PHP_INI_PERDIR Available since PHP 5.0.0. Deprecated in PHP 5.3.0. Removed in PHP 5.4.0.
Register Globals
Warning
This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
So now, the whole PHP community has to go back and re-code all our PHP programs?
Damn you all for your high and mighty "Let's give the users a kick up the ass, because they've nothing better to do".
If I could kill someone for this, I would.
michael dot buergi at gmx dot net (2013-05-08 18:18:33)
the ini-setting "detect_unicode" is indeed "zend.detect_unicode" (according to the phpinfo of my 5.4.4)
wynn dot chen dot cn at gmail dot com (2013-02-17 07:42:13)
note that when you turn on zend.multibyte,you should change mbstring internal encoding to match the script encoding.
example:
(php.ini)
zend.multibyte = On
zend.script_encoding = utf-8
;note this:
mbstring.internal_encoding = utf-8
another example:
(php.ini)
zend.multibyte = On
(script)
<?php
declare(encoding = 'utf-8');
ini_set('mbstring.internal_encoding', 'utf-8');
//now do your work...
?>
Steven Hartland (2012-10-05 14:11:44)
default_charset doesn't always set the charset for all content types, it appears to only do so for some known ones such as text/html.
If your using other content type's ensure you set the charset manually.
Tested on php 5.3.10 with application/json
iko at vision dot sk (2012-05-01 08:49:15)
auto_globals_jit setting is also affecting $_REQUEST superglobal in 5.3 It is not explicitly stated in documentation.
kghbln (2011-11-17 15:09:52)
Adding multiple directories to open_basedir:
open_basedir = "/var/www/htdocs/:/var/www/tmp/" adds both paths /var/www/htdocs/ and /var/www/tmp/. Do not forget the trailing slash, otherwise the last directory will be considered as a prefix (< 5.3.4).
On Windows you use ; as the seperator.
JL (2011-09-09 09:46:03)
If you need to use a path in your include_path that has a space in it - I found that I could make it work (in windows anyway) by setting a path like this
L:\Information Technology\Resources\lib\
in the include path like this listed below
include_path = ".;L:\Information" " Technology\Resources\lib\"
AntonioK (2011-03-10 05:29:51)
Note that there is no way to disable eval() work by using disable_functions directive, because eval() is a language construct and not a function.
Many people advise to disable such potentially-insecure functions like system(), exec(), passthru(), eval() and so on in php.ini when not running in safe mode, but eval() would still work even it listed in disable_functions.
rlammers at linuxmail dot org (2011-01-09 04:23:47)
This is a possible solution for a problem which seems to be a php-ini-problem but is not.
If a $_POST is used with large fields e.g. textarea's with more than 120kb characters php returns a blank screen, even if the max_post_size is 8M.
This problem may be caused by an apache-module SecFilter.
Adding the following lines to the .htaccess solves the problem.
SecFilterEngine Off
SecFilterScanPOST Off
I know this is not a php-issue, but i'm still posting it here since it looks like it is a php-problem and I did not find any sites or forums offering this solution.
amolitor at molitor-design dot com (2010-02-10 15:23:21)
Amusingly, the include_path logically includes the current directory of the running file as the last entry all the time anyways, so part of the business about shoving "." into the include_path is spurious -- it's "there" on the end all the time, at least in the 5.2.12 source (see main/fopen_wrappers.c around line 503).
This one had me goin' for a while.
libkhorse at gmail dot com (2009-08-06 00:14:17)
For 'short_open_tag',
though it is marked as PHP_INI_ALL in changable column,
you should note the CHANGE_LOG column also:
PHP_INI_ALL in PHP <= 4.0.0.
PHP_INI_PERDIR in PHP < 5.3.0
So as of 4.0, it will not work if you wanna use
ini_set('short_open_tag') to change it's value on the fly.
mrok at mrok dot com (2009-03-22 08:29:52)
Note that on some Unix systems (i.e. PHP 5.1.6 on Centos 5.2) include_path in php.ini should NOT be quoted.
For example, instead of
include_path='.:/usr/share/php'
use
include_path=.:/usr/share/php
Using quotes does not cause any error message, but all of your require_once() directives will fail (indicating that file could not be opened) - unless full path to target file is provided.
info at adaniels dot nl (2009-02-10 08:12:32)
When display_errors is off, PHP will send an HTTP 500 result header on a fatal error. This is usefull when working with AJAX applications.
the_tevildo at yahoo dot com (2008-11-19 08:54:47)
A handy trick to pick up parse errors in test_file.php if you can't set display_errors in php.ini or use .htaccess:
<?php
error_reporting (E_ALL);
ini_set ('display_errors', true);
include('./test_file.php');
?>
senf_glas at hotmail dot com (2008-04-09 04:31:43)
"post_max_size"
"[..]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."
using PHP 4.4.8 it seems that only the $_POST array will be empty in case of the file is largen than post_max_size.
so above mentioned method does not work in my case.
i need to use $_POST['processed'] instead of $_GET['processed']
Jeff (2008-03-11 06:17:41)
If you are having trouble getting the auto_prepend_file to work with the command line interface make sure that you have set it in the cli specific php.ini and that the read permission is set correctly for that php.ini file.
gilthans dot NO dot SPAM at gmail dot com (2007-12-03 10:52:35)
If you want to display the upload limit without knowing the server configuration, this may be useful:
<?php
function let_to_num($v){ //This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case)
$l = substr($v, -1);
$ret = substr($v, 0, -1);
switch(strtoupper($l)){
case 'P':
$ret *= 1024;
case 'T':
$ret *= 1024;
case 'G':
$ret *= 1024;
case 'M':
$ret *= 1024;
case 'K':
$ret *= 1024;
break;
}
return $ret;
}
$max_upload_size = min(let_to_num(ini_get('post_max_size')), let_to_num(ini_get('upload_max_filesize')));
echo "Maximum upload file size is ".($max_upload_size/(1024*1024))."MB.";
?>
Do note however that this limit is not completely reliable; there are other factors which need to be taken into account, such as any other $_POST data and their size, the memory limit, and the script time limit. This does, however, give some rough limit, and helps you avoid "Doh!" problems where you can't figure out why your file won't upload. :)
stepheneliotdewey at GmailDotCom (2007-06-26 16:03:57)
While the manual says that the file specified by auto_prepend_file is included as if it were called by include(), in fact the file is included as if it were called by require().
In other words, if PHP cannot find the file that you specify with auto_prepend_file, it will throw a fatal error.
lanny at freemail dot hu (2006-12-25 15:05:06)
register_long_arrays has a very odd behavior (at least in PHP 5.2):
With register_long_arrays=Off the $GLOBALS array will not contain [_SERVER] and [_REQUEST]. They are accessible as superglobals ($_SERVER, $_REQUEST), but they disappear from the $GLOBALS array!
ludicruz at yahoo dot com (2006-12-19 10:38:35)
to make sure that all requests use SSL you can use this in a file that is set for auto_prepend_file. This ensures that all requests are SSL
<?php
if(empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' )
header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") and exit();
?>
xangelusx at hotmail dot com (2006-07-24 07:28:21)
I wish the documentation was more clear as to whether the arg_separator.output character is automatically encoded when PHP outputs it. In other words, is "&" valid or do I need to specify the encoded character "&"? It would make sense to specify only "&" and hope that it is encoded as needed. That way the value could be read by other functions and encoded only when output to HTML, rather than having to test whether it is already encoded and decode it when necessary (for header redirection for example)
leo at korfu dot cz (2006-05-29 15:45:33)
"If the size of post data is greater than post_max_size..."
It seems that a more elegant way is comparison between post_max_size and $_SERVER['CONTENT_LENGTH']. Please note that the latter includes not only size of uploaded file plus post data but also multipart sequences. Leo
csg at DEL_THISdiatom dot de (2005-09-02 02:55:29)
Starting with PHP 4.4.0 (at least PHP version 4.3.10 did have old, documented behaviour) interpretation of value of "session.save_path" did change in conjunction with "save_mode" and "open_basedir" enabled.
Documented ( http://de.php.net/manual/en/ref.session.php#ini.session.save-path ):
Values of "session.save_path" should or may be **without** ending slash.
For instance:
<?php
// Valid only *before* PHP 4.4.0:
ini_set( "session.save_path", "/var/httpd/kunde/phptmp" );
?> will mean:
The directory "/var/httpd/kunde/phptmp/" will be used to write data and therefore must be writable by the web server.
Starting with PHP 4.4.0 the server complains that "/var/httpd/kunde/" is not writable.
Solution: Add an ending slash in call of ini_set (or probably whereever you set "session.save_path"), e.g.:
<?php
// Note the slash on ".....phptmp/":
ini_set( "session.save_path", "/var/httpd/kunde/phptmp/" );
?>
Hope, that does help someone.
Manu (2005-07-27 05:02:01)
Warning, if you change upload_max_filesize, please note that both post_max_size and memory_limit directives may have to change too.
david dot tulloh at infaze dot com dot au (2005-06-26 18:19:03)
I did a little experimentation on the behaviour of auto_prepend_file as the order of access wasn't clear to me from the documentation.
1. Apache checks to see if the target file exists.
2. The prepend file is called
3. The target file is called
This means that you can use auto_prepend_file to change the target file before you access it however you can't generate new files.
Joe (2005-06-09 13:05:38)
Please be mindful, that if you plan on re-configuring / recompiling to add --enable-memory-limit support, you may need to run a 'make clean' before you run 'make'. Otherwise, you may end up with a phpinfo() that shows up with --enable-memory-limit as a configure parameter, but the memory_get_usage() function will still force a fatal error.