问题
I'm using Windows 10 Home Single Language 64-bit Operating System on my machine.
I've installed the latest copy of XAMPP server on my machine which ships with PHP 7.2.7
I read following pages from the PHP Manual :
- Scan directories
- .user.ini files
After reading the text from these two pages one doubt came to my mind :
To scan the configuration INI files on a per-directory basis(in my case '.htaccess files') by PHP is it mandatory to run PHP on CLI with the --with-config-file-scan-dir
option and then by overriding at run time by setting the PHP_INI_SCAN_DIR
environment variable?
Or do such configuration INI files on a per-directory basis(in my case '.htaccess files') get scan by PHP automatically?
If yes, then please explain me how the setting made in one environment(i.e. CLI) has effect in an entirely different environment(i.e. SAPI)?
If no, then please clear my confusion with some suitable example.
回答1:
The PHP_INI_SCAN_DIR
environment variable is not related to per-directory settings, it does something entirely different. Most Linux distributions build software packages in such a way that settings are kept in different files, so it's easier to install and uninstall individual packages. So this variable is just a trick to split the main configuration file into an undetermined number of separate files inside a directory:
/etc/php.d/
how the setting made in one environment(i.e. CLI) has effect in an entirely different environment(i.e. SAPI)?
It doesn't. The Apache module will not read the FastCGI settings just like Apache will not read IIS settings.
来源:https://stackoverflow.com/questions/51427938/is-it-mandatory-to-configure-php-in-order-to-scan-configuration-ini-files-on-a-p