This list includes the core php.ini directives you can set to
configure your PHP setup. Directives handled by extensions are listed
and detailed at the extension documentation pages respectively;
Information on the session directives for example can be found at the
sessions page.
Tells whether the short form (<? ?>)
of PHP's open tag should be allowed. If you want to use PHP in
combination with XML, you can disable this option in order to
use <?xml ?> inline. Otherwise, you
can print it with PHP, for example: <?php echo '<?xml
version="1.0"'; ?>. Also if disabled, you must use the
long form of the PHP open tag (<?php ?>).
Note:
This directive also affects the shorthand <?=,
which is identical to <? echo. Use of this
shortcut requires short_open_tag
to be on.
Enables the use of ASP-like <% %> tags in addition to
the usual <?php ?> tags. This includes the
variable-value printing shorthand of <%= $value %>. For
more information, see Escaping from HTML.
Note:
Support for ASP-style tags was added in 3.0.4.
Whether to warn when arguments are passed by reference
at function call time. This method is deprecated and is likely to be
unsupported in future versions of PHP/Zend. The encouraged method of
specifying which arguments should be passed by reference is in the function
declaration. You're encouraged to try and turn this option Off and make
sure your scripts work properly with it in order to ensure they will work
with future versions of the language (you will receive a warning each time
you use this feature).
Passing arguments by reference at function call time was deprecated for
code cleanliness reason. Function can modify its argument in
undocumented way if it didn't declared that the argument is passed by
reference. To prevent side-effects it's better to specify which
arguments are passed by reference in function declaration only.
Decides whether PHP may expose the fact that it is installed on the server
(e.g. by adding its signature to the Web server header). It is no security
threat in any way, but it makes it possible to determine whether you use PHP
on your server or not.
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.
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. In order to
use this directive you must have enabled it at compile time. So,
your configure line would have included:
--enable-memory-limit. Note that
you have to set it to -1 if you don't want any limit for your memory.
As of PHP 4.3.2, and when memory_limit is enabled, the PHP function
memory_get_usage() is made available.
When an integer is used, the
value is measured in bytes. You may also use shorthand notation as described
in this FAQ.
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.
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.
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.
Set the order of the EGPCS (Environment, GET, POST, Cookie,
Server) variable parsing. The default setting of this
directive is "EGPCS". Setting this to "GP", for example,
will cause PHP to completely ignore environment variables,
cookies and server variables, and to overwrite any GET
method variables with POST-method variables of the same name.
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.
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.
Tells PHP whether or not to register the deprecated long
$HTTP_*_VARS type
predefined
variables. When On (default), long predefined PHP
variables like $HTTP_GET_VARS will be defined.
If you're not using them, it's recommended to turn them off,
for performance reasons. Instead, use the superglobal arrays,
like $_GET.
Sets max size of post data allowed. This setting also affects
file upload. To upload large files, this value must be larger
than upload_max_filesize.
If memory limit is enabled by your configure script, memory_limit also affects
file uploading. Generally speaking,
memory_limit should be
larger than post_max_size.
When an integer is used, the
value is measured in bytes. You may also use shorthand notation as described
in this FAQ.
If the size of post data is greater than post_max_size, the
$_POST and $_FILESsuperglobals
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.
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.
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 include() function, so
include_path is used.
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 include() 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.
As of 4.0b4, 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 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 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.
Specifies a list of directories where the
require(), include()
and fopen_with_path() 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.
Example G-1. Unix include_path
include_path=".:/php/includes"
Example G-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.
PHP's "root directory" on the server. Only used if
non-empty. If PHP is configured with safe mode, 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.
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 it's paths to conform to the
spec. A setting of zero causes PHP to behave as before. Default
is zero. You should fix your scripts to use SCRIPT_FILENAME rather
than PATH_TRANSLATED.
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: You can safely turn this off for
IIS, in fact, you must.
To get OmniHTTPD or Xitami to work you must turn
it off.
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.
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.
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.
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 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.