×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Marcelo Aleks
Added: May 3, 2015 7:58 PM
Views: 1913
  1. php.ini is searched in these locations (in order):
  2.  
  3. 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)
  4. The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.
  5. 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).
  6. [HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only).
  7. Current working directory (except CLI)
  8. The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows)
  9. Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option