Existe um equivalente ao cli / php.ini do Debian no Redhat?

3

Como você configura a versão de linha de comando do PHP para ter configurações diferentes em um sistema Redhat?

Em sistemas baseados em Debian, o php tem um arquivo de configuração de versão de linha de comando separado: /etc/php5/cli .

No Redhat, há /etc/php.ini e vários arquivos ini adicionais em /etc/php.d/ , mas nenhum arquivo de configuração separado para a versão de linha de comando, mesmo que o pacote php-cli esteja instalado.

    
por Zxaos 18.09.2013 / 22:27

1 resposta

4

Você tem duas opções:

  1. Use o argumento -c para indicar o local do arquivo ini
  2. Crie um arquivo php-cli.ini em /etc/

Do manual oficial do PHP :

The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI versions, it happens on every invocation.

php.ini is searched for in these locations (in order):

  • SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
  • The PHPRC environment variable. Before PHP 5.2.0, this was checked after the registry key mentioned below.
  • As of PHP 5.2.0, the location of the php.ini file can be set for different versions of PHP. The following registry keys are examined in order: [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z], [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y] and [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x], where x, y and z mean the PHP major, minor and release versions. If there is a value for IniFilePath in any of these keys, the first one found will be used as the location of the php.ini (Windows only).
  • [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only).
  • Current working directory (except CLI).
  • The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows).
  • Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option.

If php-SAPI.ini exists (where SAPI is the SAPI in use, so, for example, php-cli.ini or php-apache.ini), it is used instead of php.ini. The SAPI name can be determined with php_sapi_name().

    
por 18.09.2013 / 23:35