Diretivas do arquivo php.ini
PHP Manual

Descrição das diretivas do principais do arquivo php.ini

Essa lista inclue as diretivas principais do arquivo php.ini que você pode modificar para configurar o PHP. Diretivas manipuladas por extensões são listadas e detalhadas nas páginas de documentação de suas respectivas extensões; Informação sobre diretivas de sessão, por exemplo, podem ser encontradas nas páginas de sessão.

Opções do servidor HTTP

Opções do servidor HTTP
Nome Valor padrão Alterável Changelog
async_send "0" PHP_INI_ALL  

Opções da Linguagem

Opções e Configurações Mistas da Linguagem
Name Valor padrão Alterável Changelog
short_open_tag "1" PHP_INI_ALL PHP_INI_ALL no PHP <= 4.0.0. PHP_INI_PERDIR no PHP < 5.3.0
asp_tags "0" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.0.0.
precision "14" PHP_INI_ALL  
y2k_compliance "1" PHP_INI_ALL  
allow_call_time_pass_reference "1" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.0.0.
expose_php "1" php.ini only  
zend.ze1_compatibility_mode "0" PHP_INI_ALL Disponí­vel desde o PHP 5.0.0. Removido no PHP 5.3.0

Breve descrição das diretivas de configuração.

short_open_tag boolean

Indica quando a forma curta (<? ?>) da tag de abertura do PHP deve ser permitida. Se você quer usar o PHP em combinação com o XML, você pode desabilitar esta opção para poder usar em <?xml ?>. Entretanto, você pode exbila com o PHP, por exemplo: <?php echo '<?xml version="1.0"?>'; ?>. Também, se desabilitado, você deve usar a forma longa da tag de abertura do PHP (<?php ?>).

Nota: Esta diretiva também afeta o atalho <?=, o qual é identico a <? echo. O uso deste atalho requer que short_open_tag esteja on.

asp_tags boolean
Habilita o uso de tag no estilo ASP <% %> além das tags comuns <?php ?>. Isso inclui o atalho para impressão do valor de variável <%= $value %>. Para mais informação, veja Imprimindo HTML.
precision integer
O número de digitos de significância mostrado em números decimais (ponto flutuante).
y2k_compliance boolean
Reforça compatibilidade com ano 2000 (causará problemas com navegadores não compatí­veis)
allow_call_time_pass_reference boolean

Se deve lançar um aviso quando argumentos são passados por referência durante a chamada de uma função. Esse método é depreciado e provavelmente deixará de ser suportado em versões futuras do PHP/Zend. O método encorajado para especificar quais argumentos devem ser passados por referência é na declaração da função. Você é encorajado a tentar deligar essa opção e assegurar-se que seus script funcionam corretamente para garantir que eles funcionarão em versões futuras da linguagem (você receberá um aviso cada vez que você usar essa funcionalidade).

Passar argumentos por referência durante a chamade de uma função foi depreciado por razões de clareza de código. A função pode modificar seus argumentos de maneira não documentada se não for declarado que o argumento foi passado por referência. Para previnir efeitos-colaterais é melhor especificar quais argumentos são passados por referência apenas na declaração da função.

Veja também Entendendo Referências.

expose_php boolean

Decide se o PHP deve ou não expor o fato de que está instalado no servidor (ex.: adicionando sua assinatura ao cabeçalho do servidor Web). Não é nenhuma falha de segurança, mas torna possí­vel determinar se você usar o PHP no seu servidor ou não.

zend.ze1_compatibility_mode boolean

Habilita modo de compatibilidade com o Engine do Zend 1 (PHP 4). Isso afeta a clonagem, conversão (objetos sem propriedades são convertidos para 0), e comparação de objetos. Desse modo, objetos são passados, por padrão, por valor ao invés de referência.

Veja também a seção entitulada Migrando do PHP 4 para o PHP 5.

Limites de Recursos

Limites de Recursos
Name Valor padrão Alterável Changelog
memory_limit "128M" PHP_INI_ALL "8M" antes do PHP 5.2.0, "16M" no PHP 5.2.0

Breve descrição das diretivas de configuração.

memory_limit integer

Essa diretiva configura a quantidade máxima de memória (bytes) que o script pode alocar. Isso ajuda a previnir que scripts mal feitos consumam toda a memória disponí­vel em um servidor. Perceba que você deve configurá-la para -1 se você não quiser impor um limite de memória.

Antes do PHP 5.1.2, para poder usar essa diretiva era preciso habilitá-la durante a compilação, usando -enable-memory-limit como parâmetro para o script de configuração. Isso também era necessário para que as funções memory_get_usage() e memory_get_peak_usage() fossem definidas.

Quando um integer é utilizado, o valor é medido em bytes. A resumida notação, como descrito neste FAQ, pode também ser usada.

Veja também: max_execution_time.

Ajustes de Performance

Ajustes de Performance
Nome Valor padrão Alterável Changelog
realpath_cache_size "16K" PHP_INI_SYSTEM Disponível desde o PHP 5.1.0.
realpath_cache_ttl "120" PHP_INI_SYSTEM Disponível desde o PHP 5.1.0.

Breve descrição das diretivas de configuração.

realpath_cache_size integer

Determina o tamanho do cache de caminho real que será usado pelo PHP. Esse valor deve ser aumentado nos sistema onde o PHP abre muitos arquivos, para refletir a quantidade de operações de arquivos realizadas.

realpath_cache_ttl integer

Duração de tempo (em segundos) para cada informação do cache de caminho para um arquivo ou diretório qualquer. Para sistemas com arquivos que raramente mudam, considere aumentar o valor.

Manuseio de Dados

Opções de Configuração do Manuseio de Dados
Name Valor padrão Changeable Changelog
track_vars "On" PHP_INI_??  
arg_separator.output "&" PHP_INI_ALL Disponí­vel desde o PHP 4.0.5.
arg_separator.input "&" PHP_INI_PERDIR Disponí­vel desde o PHP 4.0.5.
variables_order "EGPCS" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 5.0.5.
request_order "" PHP_INI_SYSTEM|PHP_INI_PERDIR Disponível desde o PHP 5.3.0
auto_globals_jit "1" PHP_INI_PERDIR Disponí­vel desde o PHP 5.0.0.
register_globals "0" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.2.3.
register_argc_argv "1" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.2.3.
register_long_arrays "1" PHP_INI_PERDIR Disponí­vel desde o PHP 5.0.0.
post_max_size "8M" PHP_INI_PERDIR PHP_INI_SYSTEM no PHP <= 4.2.3. Disponí­vel desde o PHP 4.0.3.
gpc_order "GPC" PHP_INI_ALL  
auto_prepend_file NULL PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.2.3.
auto_append_file NULL PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.2.3.
default_mimetype "text/html" PHP_INI_ALL  
default_charset "" PHP_INI_ALL  
always_populate_raw_post_data "0" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.2.3. Disponí­vel desde o PHP 4.1.0.
allow_webdav_methods "0" PHP_INI_PERDIR  

Breve descrição das diretivas de configuração.

track_vars boolean

Se ativado, então as variáveis de ambiente, GET, POST, Cookie, e Server podem ser encontradas nas arrays associativas globais $_ENV, $_GET, $_POST, $_COOKIE, e $_SERVER.

Note que a partir do PHP 4.0.3, track_vars esta sempre on.

arg_separator.output string

O separador usado nas URLs geradas pelo PHP para separar os argumentos.

arg_separator.input string

List of separator(s) used by PHP to parse input URLs into variables.

Nota: 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 (removed as of PHP 6.0.0), 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.

Aviso

In both the CGI and FastCGI SAPIs, $_SERVER is also populated by values from the environment; S is always equivelant to ES regardless of the placement of E elsewhere in this directive.

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

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.

Aviso

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.

Nota: register_globals is affected by the variables_order directive.

Aviso

Este recurso tornou-se OBSOLETO a partir do PHP 5.3.0 REMOVIDO do PHP 6.0.0. Confiar neste recurso é extremamente não recomendado.

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. Quando um integer é utilizado, o valor é medido em bytes. A resumida notação, como descrito neste FAQ, pode também ser usada. 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.

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

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

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

default_mimetype string

default_charset string

A partir da versão 4.0.0, PHP sempre envia um tipo de codificação de caracteres no cabeçalho Content-type:. Para desabilitar o envio de um conjunto de caracteres, simplesmente deixe essa diretiva vazia.

always_populate_raw_post_data boolean

Sempre popular o array $HTTP_RAW_POST_DATA contendo os dados raw enviados via POST. Caso contrário, a variável é populada somente com o tipo MIME não reconhecido dos dados. No entanto, o método preferido para acessar dados raw enviados via POSTé php://input. $HTTP_RAW_POST_DATA não está disponí­vel com enctype="multipart/form-data".

allow_webdav_methods boolean

Permite lidar com requisiçõs http WebDAV dentro de scripts (ex.: PROPFIND, PROPPATCH, MOVE, COPY, etc.). Essa diretiva não existe nas versões inferiores à 4.3.2. Se você quiser receber os dados dessas requisições, você tem que ligar always_populate_raw_post_data também.

Veja também: magic_quotes_gpc, magic_quotes_runtime, e magic_quotes_sybase.

Caminhos e Diretórios

Opções de Configurações de Caminhos e Diretórios
Name Valor padrão Alterável Changelog
include_path ".;/path/to/php/pear" PHP_INI_ALL  
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  
cgi.check_shebang_line "1" PHP_INI_SYSTEM Disponí­vel desde o PHP 5.2.0.
cgi.fix_pathinfo "1" PHP_INI_SYSTEM Disponí­vel desde o PHP 4.3.0. PHP_INI_ALL antes do PHP 5.2.1.
cgi.force_redirect "1" PHP_INI_SYSTEM Disponí­vel desde o PHP 4.2.0. PHP_INI_ALL antes do PHP 5.2.1.
cgi.redirect_status_env NULL PHP_INI_SYSTEM Disponí­vel desde o PHP 4.2.0. PHP_INI_ALL antes do PHP 5.2.1.
fastcgi.impersonate "0" PHP_INI_SYSTEM Disponí­vel desde o PHP 4.3.0. PHP_INI_ALL antes do PHP 5.2.1.
cgi.rfc2616_headers "0" PHP_INI_ALL Disponí­vel desde o PHP 4.3.0.

Breve descrição das diretivas de configuração.

include_path string

Especifica a lista de diretórios onde as funções require(), include(), fopen(), file(), readfile() and file_get_contents() procurem por arquivos. O formato é como a variável de ambiente PATH do sistema: uma lista de diretórios separadas com dois-pontos no Unix e ponto-e-ví­rgula no Windows.

Exemplo #1 Unix include_path

include_path=".:/php/includes"

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

doc_root string

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.

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 compilled with debug info.

zend_extension_debug_ts string

Variant of zend_extension for extensions compilled with debug info and thread safety.

zend_extension_ts string

Variant of zend_extension for extensions compilled 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 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.

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

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

fastcgi.impersonate string

FastCGI no IIS (em SOs baseados no WINNT) suporta a habilidade de fingir tokens de segurança do cliente. Isso permite que o IIS defina o contexto de segurança que a requisição deve rodar. mod_fastcgi no Apache não atualmente não suporta essa caracterí­stica. (03/17/2002) Configure para 1 se estiver rodando no IIS. O valor padrão é zero.

cgi.rfc2616_headers int

Diz ao PHP qual tipo de cabeçalho de usar quando enviar o código de resposta HTTP. Se o valor for 0, o PHP envia um Status: cabeçalho suportado pelo Apache e outros servidores web. Quando essa opção tiver o valor 1, o PHP enviará um cabeçalho compatí­vel com o » RFC 2616. Deixe essa opção como 0 a não ser que você saiba o que está fazendo.

Envio de Arquivos

Opções de Configuração de Envio de Arquivos
Name Valor padrão Changeable Changelog
file_uploads "1" PHP_INI_SYSTEM PHP_INI_ALL no PHP <= 4.2.3. Disponí­vel desde o PHP 4.0.3.
upload_tmp_dir NULL PHP_INI_SYSTEM  
upload_max_filesize "2M" PHP_INI_PERDIR PHP_INI_ALL no PHP <= 4.2.3.

Breve descrição das diretivas de configuração.

file_uploads boolean

Se deve ou não permitir envio de arquivos via HTTP. Veja também as diretivas upload_max_filesize, upload_tmp_dir, e post_max_size.

Quando um integer é utilizado, o valor é medido em bytes. A resumida notação, como descrito neste FAQ, pode também ser usada.
upload_tmp_dir string

O diretório temporário usado para guardar arquivos quando arquivos forem enviados. O usuário do PHP deve ter permissão de escrita nesse diretório. Se não for especificado, o PHP usuará o padrão do sistema.

upload_max_filesize integer

O tamanho máximo de um arquivo enviado.

Quando um integer é utilizado, o valor é medido em bytes. A resumida notação, como descrito neste FAQ, pode também ser usada.

Opções Gerais de SQL

Opções de Configuração Geral de SQL
Name Valor padrão Alterável Changelog
sql.safe_mode "0" PHP_INI_SYSTEM  

Breve descrição das diretivas de configuração.

sql.safe_mode boolean

Se ativada, funções de conexão com banco de dados que especificam valores padrão usarão esses valores ao invés dos argumentos fornecidos. Para os valores padrão, veja a documentação das funções de conexão do seu banco de dados.


Diretivas do arquivo php.ini
PHP Manual