Setting custom path to php.ini (not in Apache)

后端 未结 2 1616
小蘑菇
小蘑菇 2020-12-10 18:13

I\'m trying to learn Symfony that \"requires\" using php in the command line / terminal for some tasks.

I like to store my php.ini in the /apache2

相关标签:
2条回答
  • 2020-12-10 19:00

    Try adding this registry key

    HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5\IniFilePath -> (your path)

    0 讨论(0)
  • 2020-12-10 19:06

    http://www.php.net/manual/en/configuration.file.php

    php.ini is searched 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 these keys, then 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

    In addition as of PHP 5.3, you can use per-directory .ini files. See http://php.net/manual/en/configuration.file.per-user.php

    0 讨论(0)
提交回复
热议问题