问题
I'm using PHP 7.2.8.
I've installed PHP using the latest version of XAMPP package which has also installed Apache/2.4.34 (Win32)
I come across the following text from the PHP Manual :
In addition to the main
php.ini
file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in$_SERVER['DOCUMENT_ROOT']
). In case the PHP file is outside the document root, only its directory is scanned.
The above text has created the following doubt in my mind which is as follows :
What the term used 'INI files' in the above text is referring to?
Whether it refers to the '.ini files' present in a directory which(the directory) is set at compile time by setting the --with-config-file-scan-dir
option, optionally, by an environment variable PHP_INI_SCAN_DIR
at run time or the '.user.ini-style INI files' like '.htaccess' files?
回答1:
… PHP scans for INI files in each directory …
This whole manual section is only about .user.ini
files.
The format is equivalent to the main
php.ini
This only applies to CGI/FCGI/FPM setups.
… in my case as I'm using Apache web server …
No relevancy to Apache/mod_php configurations.
The
.htaccess
config file andphp_flag
/php_value
directives are not INI-style.As you already know, PHP itself doesn't read them. (Well, indirectly. Apache parses them.)
Tell me whether the '.htaccess file'(in case of running PHP as Apache module) is a '.user.ini-style INI file' or not?
- It's not.
--with-config-file-scan-dir
…PHP_INI_SCAN_DIR
Does also have no relevancy to
.user.ini
nor.htaccess
files.This is used for auxilliary php.ini includes (e.g. module loading/settings, such as
/etc/php/7.3/fpm/conf.d/20-gettext.ini
/ even XAMPP should have something like this)
来源:https://stackoverflow.com/questions/52050038/does-the-term-ini-files-mean-configuration-files-parsed-after-php-ini-or-the