Edit Report a Bug

    Description of core php.ini directives

    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.

    Note:

    The defaults listed here are used when php.ini is not loaded; the values for the production and development php.ini may vary.

    Httpd Options

    Httpd Options
    Name Default Changeable Changelog
    async_send "0" PHP_INI_ALL Available since PHP 4.2.0. Removed in PHP 4.3.0.

    Language Options

    Language and Misc Configuration Options
    Name Default Changeable Changelog
    short_open_tag "1" PHP_INI_PERDIR PHP_INI_ALL in PHP 4.0.0. PHP_INI_PERDIR in PHP >= 4.0.1.
    asp_tags "0" PHP_INI_PERDIR PHP_INI_ALL in PHP 4.0.0. Removed in PHP 7.0.0.
    precision "14" PHP_INI_ALL  
    serialize_precision "17" PHP_INI_ALL Available since PHP 4.3.2. Until PHP 5.3.5, the default value was 100.
    y2k_compliance "1" PHP_INI_ALL Removed in PHP 5.4.0.
    allow_call_time_pass_reference "1" PHP_INI_PERDIR PHP_INI_ALL in PHP 4.0.0. Removed in PHP 5.4.0.
    disable_functions "" PHP_INI_SYSTEM only Available since PHP 4.0.1.
    disable_classes "" php.ini only Available since PHP 4.3.2.
    exit_on_timeout "" PHP_INI_ALL Available since PHP 5.3.0.
    expose_php "1" php.ini only  
    zend.multibyte "0" PHP_INI_ALL Available since PHP 5.4.0
    zend.script_encoding NULL PHP_INI_ALL Available since PHP 5.4.0
    zend.detect-unicode NULL PHP_INI_ALL Available since PHP 5.4.0
    zend.signal_check "0" PHP_INI_SYSTEM Available since PHP 5.4.0
    zend.assertions "1" PHP_INI_ALL Available since PHP 7.0.0.
    zend.ze1_compatibility_mode "0" PHP_INI_ALL Available since PHP 5.0.0. Removed in PHP 5.3.0
    detect_unicode "1" PHP_INI_ALL Available since PHP 5.1.0. Renamed to zend.detect-unicode from PHP 5.4.0.

    Here's a short explanation of the configuration directives.

    short_open_tag boolean

    Tells PHP 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 affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available.

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

    Changelog for asp_tags
    Version Description
    7.0.0 Removed from PHP.

    precision integer
    The number of significant digits displayed in floating point numbers.
    serialize_precision integer
    The number of significant digits stored while serializing 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. 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 reasons. A function can modify its arguments in an undocumented way if it didn't declare that the argument shall be passed by reference. To prevent side-effects it's better to specify which arguments are passed by reference in the function declaration only.

    See also References Explained.

    Changelog for allow_call_time_pass_reference
    Version Description
    5.4.0 Removed from 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

    Exposes to the world that PHP is installed on the server, which includes the PHP version within the HTTP header (e.g., X-Powered-By: PHP/5.3.7). Prior to PHP 5.5.0 the PHP logo guids are also exposed, thus appending them to the URL of your PHP script would display the appropriate logo (e.g., » www.php.net/?=PHPE9568F34-D428-11d2-A769-00AA001ACF42). This also affected the output of phpinfo(), as when disabled, the PHP logo and credits information would 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

    This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. disable_functions is not affected by Safe Mode.

    Only internal functions can be disabled using this directive. User-defined functions are unaffected.

    This directive must be set in php.ini For example, you cannot set this in httpd.conf.

    disable_classes string
    This directive allows you to disable certain classes for security reasons. It takes on a comma-delimited list of class names. disable_classes is not affected by Safe Mode. This directive must be set in php.ini For example, you cannot set this in httpd.conf.
    zend.assertions integer
    When set to 1, assertion code will be generated and executed (development mode). When set to 0, assertion code will be generated but it will be skipped (not executed) at runtime. When set to -1, assertion code will not be generated, making the assetions zero-cost (production mode).
    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.

    Warning

    This feature has been DEPRECATED and REMOVED as of PHP 5.3.0.

    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.

    Resource Limits

    Resource Limits
    Name Default Changeable Changelog
    memory_limit "128M" PHP_INI_ALL "8M" before PHP 5.2.0, "16M" in PHP 5.2.0

    Here's a short explanation of the configuration directives.

    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.

    When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.

    See also: max_execution_time.

    Performance Tuning

    Performance Tuning
    Name Default Changeable Changelog
    realpath_cache_size "16K" PHP_INI_SYSTEM Available since PHP 5.1.0.
    realpath_cache_ttl "120" PHP_INI_SYSTEM Available since PHP 5.1.0.

    Here's a short explanation of the configuration directives.

    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.

    Data Handling

    Data Handling Configuration Options
    Name Default Changeable Changelog
    arg_separator.output "&" PHP_INI_ALL Available since PHP 4.0.5.
    arg_separator.input "&" PHP_INI_PERDIR Available since PHP 4.0.5.
    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 PHP_INI_ALL in PHP <= 4.2.3. Removed in PHP 5.4.0.
    register_argc_argv "1" PHP_INI_PERDIR PHP_INI_ALL in PHP <= 4.2.3.
    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.
    enable_post_data_reading "1" PHP_INI_PERDIR Available since PHP 5.4.0
    post_max_size "8M" PHP_INI_PERDIR PHP_INI_SYSTEM in PHP <= 4.2.3. Available since PHP 4.0.3.
    auto_prepend_file NULL PHP_INI_PERDIR PHP_INI_ALL in PHP <= 4.2.3.
    auto_append_file NULL PHP_INI_PERDIR PHP_INI_ALL in PHP <= 4.2.3.
    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 PHP_INI_ALL in PHP <= 4.2.3. Available since PHP 4.1.0. Removed in PHP 7.0.0.

    Here's a short explanation of the configuration directives.

    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.

    Warning

    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.

    Warning

    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) varia

    gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.