PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

List of Supported Timezones> <Direktivy php.ini
Last updated: Sat, 24 Mar 2007

view this page in

Popis základních direktiv php.ini

Tento seznam zahrnuje základní direktivy php.ini, kterými můžete nastavovat konfiguraci PHP. Direktivy obsluhované pomocí rozšíření jsou sepsány (včetně detailů) v dokumentačních stránkách příslušných rozšíření. Např. informace o direktivách týkajících se sessions lze najít na stránkách o sessions.

Volby httpd

Tabulka H.3. Volby httpd

NázevDefaultLze měnitPřehled změn (changelog)
async_send"0"PHP_INI_ALL 

Jazykové volby

Tabulka H.4. Jazykové a ostatní konfigurační volby

NázevVýchozíLze měnitPřehled změn (changelog)
short_open_tag"1"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.0.0.
asp_tags"0"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.0.0.
precision"14"PHP_INI_ALL 
y2k_compliance"1"PHP_INI_ALL 
allow_call_time_pass_reference"1"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.0.0.
expose_php"1"pouze php.ini 
zend.ze1_compatibility_mode"0"PHP_INI_ALLK dispozici od PHP 5.0.0.

Zde je stručný popis konfiguračních direktiv.

short_open_tag boolean

Říká, zda by měla být povolena krátká forma (<? ?>) otevírací značky PHP. Chcete-li používat PHP v kombinaci s XML, můžete tuto volbu vypnout kvůli možnosti vkládat <?xml ?>. Jinak můžete pomocí PHP tisknout například: <?php echo '<?xml version="1.0"'; ?>. Pokud je však krátká forma vypnuta, musíte používat dlouhou formu otevírací značky PHP (<?php ?>).

Poznámka: Tato direktiva má dopady i na zkratku <?=, která je totožná s <? echo. Použití této zkratky vyžaduje, aby byla volba short_open_tag zapnuta.

asp_tags boolean

Povolí používání značek <% %> jako v ASP, navíc k obvyklým značkám <?php ?>. Zahrnuje to též zkratku pro tisk hodnot proměnných: <%= $value %>. Pro více informací viz Escaping from HTML.

Poznámka: Support for ASP-style tags was added in 3.0.4.

precision integer
The number of significant digits displayed in floating point numbers.
y2k_compliance boolean
Enforce year 2000 compliance (will cause problems with non-compliant browsers)
allow_call_time_pass_reference boolean

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.

See also References Explained.

expose_php boolean

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.

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.

Resource Limits

Tabulka H.5. Resource Limits

NázevVýchozíLze měnitPřehled změn (changelog)
memory_limit"8M"PHP_INI_ALL 

Zde je stručný popis konfiguračních direktiv.

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. 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.

Připoužítí typu integer je hodnota měřena v bytech. Můžete také použít zkrácenou notaci, jak je popsáno tomto FAQ.

See also: max_execution_time.

Performance Tuning

Tabulka H.6. Performance Tuning

NázevVýchozíLze měnitPřehled změn (changelog)
realpath_cache_size"16K"PHP_INI_SYSTEMK dispozici od PHP 5.1.0.
realpath_cache_ttl"120"PHP_INI_SYSTEMK dispozici od PHP 5.1.0.

Zde je stručný popis konfiguračních direktiv.

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.

Data Handling

Tabulka H.7. Data Handling Configuration Options

NázevVýchozíLze měnitPřehled změn (changelog)
track_vars"On"PHP_INI_?? 
arg_separator.output"&"PHP_INI_ALLK dispozici od PHP 4.0.5.
arg_separator.input"&"PHP_INI_PERDIRK dispozici od PHP 4.0.5.
variables_order"EGPCS"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 5.0.5.
auto_globals_jit"1"PHP_INI_PERDIRK dispozici od PHP 5.0.0.
register_globals"0"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.2.3.
register_argc_argv"1"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.2.3.
register_long_arrays"1"PHP_INI_PERDIRK dispozici od PHP 5.0.0.
post_max_size"8M"PHP_INI_PERDIRPHP_INI_SYSTEM v PHP <= 4.2.3. K dispozici od PHP 4.0.3.
gpc_order"GPC"PHP_INI_ALL 
auto_prepend_fileNULLPHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.2.3.
auto_append_fileNULLPHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.2.3.
default_mimetype"text/html"PHP_INI_ALL 
default_charset""PHP_INI_ALL 
always_populate_raw_post_data"0"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.2.3. K dispozici od PHP 4.1.0.
allow_webdav_methods"0"PHP_INI_PERDIR 

Zde je stručný popis konfiguračních direktiv.

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.

Poznámka: Every character in this directive is considered as separator!

variables_order string

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.

See also register_globals.

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.

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.

Poznámka: register_globals is affected by the variables_order directive.

This directive was removed in PHP 6.0.0.

register_argc_argv boolean

Tells PHP whether to declare the argv & argc variables (that would contain the GET information).

See also command line. Also, this directive became available in PHP 4.0.0 and was always "on" before that.

register_long_arrays boolean

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.

This directive became available in PHP 5.0.0 and was dropped in PHP 6.0.0.

post_max_size integer

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.

Připoužítí typu integer je hodnota měřena v bytech. Můžete také použít zkrácenou notaci, jak je popsáno tomto 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.

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.

Poznámka: 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 include() 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 include() function, so include_path is used.

The special value none disables auto-appending.

Poznámka: If the script is terminated with exit(), auto-append will not occur.

default_mimetype string

default_charset string

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_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.

Paths and Directories

Tabulka H.8. Paths and Directories Configuration Options

NázevVýchozíLze měnitPřehled změn (changelog)
include_path".;/path/to/php/pear"PHP_INI_ALL 
doc_rootNULLPHP_INI_SYSTEM 
user_dirNULLPHP_INI_SYSTEM 
extension_dir"/path/to/php"PHP_INI_SYSTEM 
extensionNULLpouze php.ini 
cgi.fix_pathinfo"1"PHP_INI_ALLK dispozici od PHP 4.3.0.
cgi.force_redirect"1"PHP_INI_ALLK dispozici od PHP 4.2.0.
cgi.redirect_status_envNULLPHP_INI_ALLK dispozici od PHP 4.2.0.
fastcgi.impersonate"0"PHP_INI_ALLK dispozici od PHP 4.3.0.
cgi.rfc2616_headers"0"PHP_INI_ALLK dispozici od PHP 4.3.0.

Zde je stručný popis konfiguračních direktiv.

include_path string

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.

Příklad H.1. Unix include_path


include_path=".:/php/includes"

          


Příklad H.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.

doc_root string

PHP's "root directory" on the server. Only used if non-empty. If PHP is configured with bezpečný režim, 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.

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 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 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.

Poznámka: 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.

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.

Poznámka: Setting this variable may cause security issues, know what you are doing first.

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.

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.

File Uploads

Tabulka H.9. File Uploads Configuration Options

NázevVýchozíLze měnitPřehled změn (changelog)
file_uploads"1"PHP_INI_SYSTEMPHP_INI_ALL v PHP <= 4.2.3. K dispozici od PHP 4.0.3.
upload_tmp_dirNULLPHP_INI_SYSTEM 
upload_max_filesize"2M"PHP_INI_PERDIRPHP_INI_ALL v PHP <= 4.2.3.

Zde je stručný popis konfiguračních direktiv.

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.

Připoužítí typu integer je hodnota měřena v bytech. Můžete také použít zkrácenou notaci, jak je popsáno tomto 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.

upload_max_filesize integer

The maximum size of an uploaded file.

Připoužítí typu integer je hodnota měřena v bytech. Můžete také použít zkrácenou notaci, jak je popsáno tomto FAQ.

General SQL

Tabulka H.10. General SQL Configuration Options

NázevVýchozíLze měnitPřehled změn (changelog)
sql.safe_mode"0"PHP_INI_SYSTEM 

Zde je stručný popis konfiguračních direktiv.

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.

Debugger Configuration Directives

Výstraha

Only PHP 3 implements a default debugger, for more information see F – „Ladění (debugging) PHP.

debugger.host string

DNS name or IP address of host used by the debugger.

debugger.port string

Port number used by the debugger.

debugger.enabled boolean

Whether the debugger is enabled.



List of Supported Timezones> <Direktivy php.ini
Last updated: Sat, 24 Mar 2007
 
add a note add a note User Contributed Notes
Popis základních direktiv php.ini
senf_glas at hotmail dot com
09-Apr-2008 01:31
"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
11-Mar-2008 03:17
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
03-Dec-2007 07:52
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
27-Jun-2007 01:03
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
26-Dec-2006 12:05
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
19-Dec-2006 07:38
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
24-Jul-2006 04:28
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 "&amp;"? 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
30-May-2006 12:45
"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
02-Sep-2005 11:55
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
27-Jul-2005 02:02
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
27-Jun-2005 03:19
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
09-Jun-2005 10:05
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.

List of Supported Timezones> <Direktivy php.ini
Last updated: Sat, 24 Mar 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites